• Blog posts


    By David Crowther 



    What is the purpose and where is the Data Directory within GeoServer? 


    The Data Directory (Data_Dir) sets the location for all of the configurable items within GeoServer, including the Workspaces, Data Stores, Layers and Styles that you create.


    The location of the Data Directory is first set when you install GeoServer and is specified in the following installation step.


    The default location for the Data Directory will likely be in the Data_Dir folder, which is created when you install GeoServer.

    For first time installations this can be fine, however, when you come to upgrade your GeoServer Instance you will again be asked where the Data_Dir should be placed. If you choose to leave the Data Directory as the default location then this may either ignore your previous Data Directory or overwrite it, which will result in you losing all of your configuration.

    Therefore when you first install GeoServer you may wish to choose a folder outside of the GeoServer installation location, which is always accessible and will not be overwritten. Then when you come to upgrade GeoServer ensure that you choose the second option to use an Existing data directory e.g.


    Now once GeoServer has been updated the Data Directory will be set to the chosen location and all of your previous configuration will be retained.

    If you wish to change the location that GeoServer uses for the Data Directory (in a Windows environment) this can be managed via the Environment Variables of the server/machine being used. Once GeoServer is installed and you first set the Data Directory location the system will create an Environment Variable named GEOSERVER_DATA_DIR. The Environment Variables can be accessed via the Advanced System Properties > Environment Variables:


    Should you therefore wish to change the Data Directory for GeoServer, you can simply edit the Value for the GEOSERVER_DATA_DIR to be another folder location. 

    Note: If the location of the GeoServer data directory is not set explicitly, the directory Data_Dir under the root of the GeoServer installation will be chosen by default.