Perforce Public Knowledge Base - Moving Server Components on the Same Machine
Perforce Software logo
Reset Search
 

 

Article

Moving Server Components on the Same Machine

« Go Back

Information

 
Problem

How can I move various components of the Perforce Server to different disks or different directories on the same machine?

Note: If your goal is to migrate to new server hardware, please see KB Article: Moving a Perforce Server.

This article concerns moving components such as the P4ROOT path and depot and journal locations.

Solution

Moving the Perforce Server Root Location

The server root directory is where the Perforce server's database (db.*) files are located. If you change your Perforce server root directory, be sure to move the database files to that new location.

The server root directory for Perforce defaults to the p4d executable directory. You change the server root with the p4d -r startup flag or the P4ROOT environment variable.

Note: Changing the P4ROOT value while the server is running is safe, as it is only read during server startup.

If the server is started as a Windows Service, you can change the server root by using p4 set. For example:

p4 set -S "Perforce" P4ROOT=E:\Perforce

Note: The default service name is "Perforce". If you are running multiple Perforce service instances, you will need to specify P4ROOT for each instance separately.

 

Changing the Perforce Port

The server port defaults to 1666. You change the server port with the p4d -p startup flag or the P4PORT environment variable.

 

Note: Changing the P4PORT value while the server is running is safe, as it is only read during server startup.

If the server is started as a Windows Service, you can change the server port by using p4 set, for example:

 

p4 set -S "Perforce" P4PORT=1669
Note: Unless you are using a free 20/20 license, you'll will likely need to submit a Change of Server request to get a new license for the new port prior to changing the P4PORT value of your Perforce server.

Moving the Depot Location

 

By default, new Depot directories are created relative to the Perforce server root directory (P4ROOT). You can change the depot location by changing the "Map:" field of the depot specification with the following command:

p4 depot <depot_name>

The "Map:" field is relative to the server root (P4ROOT) setting for your server. To store a depot on another drive, please specify an absolute path in the "Map:" field. On Windows systems this will include the drive letter for the path.

For detailed steps on how to move the depot location safely, see the following:

KB Article: Having the Depot on Windows Network Drive

KB Article: Moving depot files to a different location

 

Moving Journal File Location 

The live journal defaults to "journal" in the Perforce server root directory (P4ROOT). You can change its name and path with the -J option or the P4JOURNAL environment variable when the server is restarted. If a relative path is provided, it should be relative to the server root.

Example:

p4 admin stop

copy %P4ROOT%\journal  D:\JOURNAL\perforce_journal

p4d -r %P4ROOT% -J D:\JOURNAL\perforce_journal

del %P4ROOT%\journal 

On a Windows service, change the environmental variable to point to the new journal location

p4 set -S "Perforce" P4JOURNAL=D:\JOURNAL\perforce_journal

Note: Shutdown the server (or stop the Windows service) to copy the journal file to its new location before modifying the journal file location, then restart the server (or restart the Windows service).

Moving the Log File Location

 

The server log is defaulted to the standard error. You can change its name and path with the -L option or the P4LOG environment variable when the server is restarted.

Example:

p4 admin stop

p4 set -S "Perforce" P4LOG=D:\LOG\perforce_log

net start Perforce

 

Moving p4d/p4s executable Location

 

In general, the Perforce Server executable is located in a directory that can be found by your operating system's search path. For example, it can be located in "/usr/local/bin" on UNIX, or the default "C:\Program Files\Perforce\Server\" on Windows. You can move the p4d executable to its new location, and then make sure that it can be located by your startup script or command.

The Perforce Server on Windows is usually started as a Windows Service, and the path to the p4s.exe executable is set in the registry. The easiest way to change this is by running the installer to move the Perforce Service executable location.

See more about Environment and Registry values in the Perforce Command Reference.

 

Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255