Rename a Vserver step by step

Suppose you made a mistake on the Vserver name when creating it. After finished the installation, you might want to rename your Vserver. This can be accomplished by renaming the config directory and the root for the vserver in question, then modifying some symlinks to match.

The general steps are:

    • Stop the vserver in question

It can be done by this command: “vserver <server name> stop

    • Rename the /vservers/<server name> directory

By default it’s in /vservers, and on some self-crafted versions, it might be re-defined to other path like /var/lib/vservers. Simply you just need to use mv command to rename the issued vserver.

    • Rename the /etc/vservers/<server name> directory

The directory /etc/vservers is much like a system wide configuration directory for vservers, you can use mv to rename specified directory as well.

    • Update some softlink in /etc/vservers/<server name>

update link: /etc/vservers/<server name>/run -> /var/run/vservers/<server name>
update link: /etc/vservers/<server name>/vdir -> /etc/vservers/.defaults/vdirbase/<server name>
update link: /etc/vservers/<server name>/cache -> /etc/vservers/.defaults/cachebase/<server name>
Pay some attention to relative path issue, otherwise these links might get broken, there’s an example, the current working directory is /etc/vservers/mars:

joseph@galaxy:/etc/vservers/mars$ ln -s -f /etc/vservers/.defaults/vdirbase/mars vdir
    • Update link: /var/run/vservers.rev/<server XID> -> /etc/vservers/<server name>

Please note that this just an update by fixing the dead link, and there’s no need to create a new XID.

    • Reset hostname for vserver in question

Basically you just need to modify /etc/vservers/<server name>/uts/nodename before starting the issued vserver, and get other host name related settings modified when system booted.

joseph@galaxy:/etc/vservers$ grep mars -R mars/ 2>/dev/null -l

Now, It should start properly. If any issue encountered, please don’t hesitate to raise a forum thread at our community forum.

Share this post

Post Comment