How to clone a PS4 server
What is it
Every now and then you might need to create an exact copy of your PS4 system, for example to prepare a temporary test system.
Prerequisites
Cloning requires copying your data, e.g. make a clone of your volume(s) (a typical PS4 server has just one volume). Thanks to virtual machine technology this has become a pretty easy task. How exactly to achieve it is up to your concrete VM or cloud platform.
In msg.Cloud proceed as follows:
- Your PS4 is connected to at least one storage (which other environments call "volume" or "virtual disk"). Access the detail pane of this storage (either through "attached storages" on your server's detail pane or through the VDC dashboard's listing of all storages in your tenant/project) and press the Create Snapshot button. This creates a copy of your data.
- Now you have to convert the snapshot into a template. Basically, a template is a snapshot which can be used for other VMs. On the storeage detail pane you find a list of all snapshots of this storage. To the right there is a "CD icon". It leads into the Create new template pane where you just provide a name and then press Create template.
- Lastly, create a new storage. Provide a name and then - instead of setting the storage capacity - you select the My Templates tab in the lower part of the pane. Choose your template from the displayed list, then click "Create storage". A new storage is created which is an exact copy of the disk which you snapshotted initially.
Note that the above procedure works well if source and desination VM are in the same network (SCA). If you want to create the clone in another SCA this is possible but you need cloud support for transferring the snapshot(s). In the destination SCA you will then find them in tab "Marketplace".
As a second prerequisite you need an unused IP address for the target system.
How to achieve it
- Create a new virtual machine (the exact way how to achive that depends on your cloud provider or virtualization platform).
- Attach the volume(s) to the virtual machine. Do not yet attach a network to the VM because it would use the IP address of the VM where you copied the volumens from, leading to confusion on the network.
- Start the VM and open its console terminal (sometimes also named "serial console").
- When the VM has booted up login as "root".
- Edit the following files:
- /etc/network/interfaces: The entry of your primary interface (most likely the only "iface" entry in this file) replace the IP address in the "address" line by the unused one. If you stay within the same network as the VM you cloned from you may leave all other settings in this file untouched. \
Caveat: In some clouds (e.g. msg.Cloud) the target VM may have a different network interface name, e.g. "enp0s17" instead of "ens17". The symptom is that you have no network connectivity. Check the FAQ entry After cloning a PS4 system there is no network connectivity any more for a solution. - /etc/hosts: Replace the original IP address with the new one.
- /etc/issue: This file is displayed on login. Change the information provided in this file accordingly. Missing to do this puts you on risk to mix up original VM and its clone which may lead to very undesireable results.
- /etc/motd: This is similar to /etc/issue.
- Depending on your workload you may have to modify other configuration settings (see below under "Good to know").
- /etc/network/interfaces: The entry of your primary interface (most likely the only "iface" entry in this file) replace the IP address in the "address" line by the unused one. If you stay within the same network as the VM you cloned from you may leave all other settings in this file untouched. \
- Stop the VM: shutdown -H now
- Once stopped attach a network to the VM.
- Start the VM. You can now begin to work with this clone.
Good to know
All applications on the cloned PS4 work on their own storage and talk to their counterparts on the same PS4 instance, completely separated from the original PS4 instance. But any communication relations to the outside world (e.g. network connections to external servers) are still configured identically to the original machine. You may therefore have to modify further configuration settings so that such traffic is routed to other servers. If you for example clone a test system from a production sytems which places orders to an external production system you most likely do not want the test system to do the same. Therefore it may be necessary to first check all your services and reroute them to other destinations before you attach a network to your cloned VM for the first time.