Create a personal system image

The ability to create a system image serves many purposes: for creating your own system with your favorite applications pre-installed, preparing an image of an easily mountable game server, cloning a fine-tuned server, or simply making a backup of your system.

You can clone a disk from its management page and use it to create a new VPS – this way is simpler and faster than the usual process with “dd” described below, which can cause disk errors if the steps are not followed scrupulously.

Creating a system image from a Gandi server

The process is really quite simple and may be done by anyone who follows these steps carefully:

1. Create a data disk

You must first create a data disk with a maximum of 3 GB (this limit is temporary). This can be done from the disk creation interface in your hosting account. If you do not have enough disk space, you can purchase more during the operation.

2. Attach the disk to the server to be copied

Simply attach your new disk to the server you want to make an image of.

3. Create the system image

To create the image of your system and copy it to your newly-created data disk, you must first use the UNIX command dd.

The syntax of the command requires a bit of attention, however. Here is an example that we will examine in a second:

dd if=/dev/xvda of=/dev/xvdc conv=sync

The if parameter corresponds to the path of the source (the system that we want to copy), while of is the path to the destination disk (the data disk where you want to copy the data that you just created).

To see the paths of your disks, use the df command.

Please note, however, that the path to use for the if operation will always be /dev/xvda. If not set up this way, the image will not be bootable.

You need to re-configure the network of your machine in DHCP before proceeding with the creation of the image. Please note that the dd takes some time, because it is copying the source disk to the destination disk bit by bit.

The Linux kernel of a Gandi virtual machine boots on the first partition by default (root=/dev/xvda1 on the boot command line). If you copy an existing system disk, the partition table will be correct. Otherwise, please make sure your primary disk partition contains your system files and is bootable. You can also add a second partition containing a swap space.

4. Remove the disk

Return to your disk management interface in your Gandi hosting account and unmount the destination disk (onto which you have copied the system image) from your server.

5. Change the type of disk and make it bootable

On the Gandi.net control panel, you are now able to define a kernel for the data disk which is adapted to the image you have just created.

For example, take a data disk on the control panel that you want to transform into a system/image disk:

Use the link to modify the disk information. You will find an option at the bottom of the page to use the data disk as a system disk:

You will then have access to the advanced options found on a system disk:

After adding a kernel, the disk can then be used as a “personal image” – it will be included in the list of available images when you create a new server from the control panel.

6. Create a new server from the image

Now all that remains is to create a new server. The only difference will be in the choice of your system, as you now have an extra option: use your custom-made image!

We are currently working on Gandi disk images (game servers for example) that we will soon be able to offer you, as well as extend the disk size to over 3GB.

7. Making a correction to an image

Afterwards, if you find you have forgotten something or need to correct a parameter, all you have to do is attach the image to a server, correct the error and detach the disk. The image will be available once again for creating new servers without having to spend time making copies via dd again.

There is no longer a 3 GB limit for the system disk. You can now create images from disks of a larger size.

Creating a system image from your own ISO

The process is essentially the same as described above, except for these extra steps:

  1. Create an ISO if you haven't already
  2. Transfer your ISO to the disk of a running VPS server
  3. Mount the ISO as a separate volume
  4. Proceed with the dd command as described above.

You will need to have advanced Linux system administration skills to copy the ISO to the VPS, mount it as a volume and then use the procedure referenced above to copy the ISO content to the new disk volume using dd.

For example, it may be that the particular requirements of your runtime CD require a specific volume some, or specific settings for the dd command in order to work. We can't know this in advance, and so we can't tell you exactly how to do this.

Therefore, please do not attempt this unless you are sure you know exactly what you are doing. We won't be able to guide you through the steps.

See also

Last modified: 07/12/2012 at 19:40 by Amy B. (Gandi)