Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2026.1

# p4 serverid

Get or set the unique ID associated with a P4 Server.

## Syntax

    p4 [g-opts] serverid [serverID]

Syntax and naming conventions

## Description

p4 serverid retrieves or sets the unique ID of a P4 Server by reading or writing the `server.id` file in the server’s root directory.

When you configure servers in a multi-server installation, assign to each server its own unique ID and specify the server configuration for that unique ID.

### Back up the server.id file

The `server.id` file is in the server’s root directory (see P4ROOT), and this file must be backed up. If you are using the `p4 server` command to configure your servers, and one of your servers suffers a catastrophic data loss, any attempt to restart the restored server requires that the `server.id` file be present (or be re-created).

### serverid and P4NAME

Use the p4 serverid command instead of setting the deprecated `P4NAME` environment variable. If both `P4NAME` and `serverID` are set, make sure that the value of `serverID` matches the value of `P4NAME`. Otherwise configuration problems can occur.

### serverid and UUID

The `p4 serverid` command can be run before or after the creation of a server spec. However, if you are creating a server spec with a unique ID (UUID), first run `p4 server -g` to generate a UUID, and then run `p4 serverid serverID` where `serverID` is the UUID.

### To create or reset the serverID

If you want to manually add a `server.id` file or change the server ID:

1. Run p4 info and make a note of your P4 Server root (see P4ROOT).
2. Stop the server.
   For example:
   p4 admin stop

3. Remove the existing `server.id` file.
   For example:
   cd /path/to/your-server-root-directory
   rm server.id

4. Start the server.
5. Run the p4 serverid command to assign an new server ID to your server.

   `p4 serverid yourNewNameForTheServer`

6. Adjust any configurables associated with the new server ID, `yourNewNameForTheServer`
   For example:
   p4 configure show allservers
   p4 configure set yourNewNameForTheServer#monitor=2
7. Adjust the fields of the server specification that depend on the serverID value, such as ReplicatingFrom field.

## Options

Option | Description
--- | ---
`serverID` | If supplied, update `server.id` with the unique ID of the server.
`g-opts` | See Global options.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | list, or `super` to set the server ID

## Related commands

To edit or view a server specification | `p4 server`
To list all known servers | `p4 servers`

Your search for returned results