Linode Library Home
Linode Library RSS Feed
Home :: Migration
Print View View Source

Copying a Disk Image to a Different Account

Published: by

You can copy a Linode's disk image from one Linode account to another. This is a great way to prepare a disk image for another Linode customer and transfer it from your account to the other user's account. Or if you have multiple Linode accounts, you can use this guide to consolidate all of your disk images in one account.

Contents

Preparing the Source Linode

Before initiating the transfer, you'll need to prepare the source Linode that contains the disk image you want to copy. Start the Linode in rescue mode to transfer files to the other account. Here's how:

  1. Boot your Linode into Rescue Mode. For instructions, see Booting into Rescue Mode.
  2. After the Linode has booted, connect to it via LISH. For instructions, see Connecting to a Linode Running in rescue mode.

Your Linode is now ready to transfer files to the other account.

Preparing the Receiving Linode

You'll also need to prepare the receiving Linode before initiating the transfer. First, create a new disk image to hold the files from the other Linode. Then start the Linode in rescue mode to receive the files from the other account.

Creating a New Disk Image

To hold the files that will be transferred from the other Linode, you should create a new disk image. Here's how:

  1. Log in to the Linode Manager with the account that will be receiving the disk image.
  2. Click the Linodes tab. A list of your virtual private servers appears.
  3. Select the Linode that will be receiving the disk image. The Linode's dashboard appears.
  4. Create a disk image to hold the files from the other account's disk image. Select Create a new Disk Image. The webpage shown below appears.
Creating a configuration profile
  1. Enter a descriptive name for the disk image in the Label field.
  2. Enter a size for the disk image in the Size field. You should make the disk image large enough to hold the contents of the other disk image.
  3. Click Save Changes to create the disk image. You can monitor the disk image creation process by watching the Host Job Queue.

You have successfully created a disk image to hold the files from the other account's disk image.

Booting into Rescue Mode

Start the receiving Linode in rescue mode. Here's how:

  1. Boot your Linode into Rescue Mode. For instructions, see Booting into Rescue Mode.
  2. After the Linode has booted, connect to it via LISH. For instructions, see Connecting to a Linode in Rescue Mode.
  3. Start SSH. For instructions, see Start SSH.

Your Linode is now ready to receive the files from the other Linode account.

Copying the Disk Image

Now it's time to start copying the files on the disk image from one account to another. Here's how to initiate the file transfer:

  1. On the source Linode, enter the following command to start copying the disk image, replacing 12.34.56.78 with your Linode's IP address.:

    dd if=/dev/xvda | ssh -C 12.34.56.78 "dd of=/dev/xvda"
    
  2. The following output appears. Enter yes to continue connecting:

    The authenticity of host '12.34.56.78 (12.34.56.78)' can't be established.
    RSA key fingerprint is 20:f4:de:4d:5c:6e:a9:c7:e6:1f:8a:ad:60:62:96:3f.
    Are you sure you want to continue connecting (yes/no)?
    
  3. You will be prompted for the root password. Enter the password you created in the last section when you started the SSH server:

    root@12.34.56.78's password:
    
  4. The file transfer will start, as shown below:

    2048000+0 records in
    2048000+0 records out
    1048576000 bytes (1.0 GB) copied, 391.504 seconds, 2.7 MB/s
    2048000+0 records in
    2048000+0 records out
    1048576000 bytes (1.0 GB) copied, 387.843 seconds, 2.7 MB/s
    

Wait for the transfer to complete. Note that this process can take a while, depending on the size of your disk image.

Verifying the Disk Image

After the file transfer has completed, you should verify the disk image by mounting it on the receiving Linode. Here's how:

  1. Make a new directory for the disk image by entering the following command:

    mkdir linode
    
  2. Mount the disk image by entering the following command:

    mount /dev/xvda linode
    
  3. View the directories in the disk image by entering the following command:

    ls linode/
    
  4. The output should appear similar to what's shown below:

    bin   dev  home  lost+found  mnt  proc  sbin     srv  tmp  var
    boot  etc  lib   media       opt  root  selinux  sys  usr
    

Now that you've ready to boot from the disk image.

Booting from the Disk Image

Now it's time to boot from the disk image. First, you'll create a configuration profile on the receiving Linode, and then you'll boot the receiving Linode with the disk image you just transferred.

Creating the Configuration Profile

The boot the receiving Linode from the transferred disk image, you'll need to create a new configuration profile. Here's how:

  1. Click the Linodes tab. A list of your virtual private servers appears.
  2. Select the Linode that received the disk image. The Linode's dashboard appears.
  3. Select Create a new Configuration Profile. The webpage shown below appears.
Selecting the configuration profile
  1. Enter a name for the configuration profile in the Label field, such as Received Disk Image.
  2. In the Block Device Assignment section, set /dev/xvda to Received Disk Image.
  3. Set /dev/xvdb to a swap disk image.
  4. Click Save Changes.

You have successfully created the configuration profile.

Booting the Receiving Linode

Now to start the receiving Linode from the transferred disk image, you'll need to select the configuration profile you just created. Here's how:

  1. From the Linode's dashboard, select the Received Disk Image configuration profile you created in the last section, as shown below.
Selecting the configuration profile
  1. Click Reboot to restart the Linode from the transferred disk image.

Your Linode will boot using the disk image you transferred.

Creative Commons License

This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.

Last edited by Matthew Cone on Monday, February 4th, 2013 (r3309).