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

Copying a Disk to a Separate Linode Account

Published: Monday, October 19th, 2009 by Phil Paradis

If you'd like to copy a Linode's disk image to another Linode that resides in a separate account, you can easily do so using SSH and the Finnix Recovery distribution. This may be useful in cases where you'd like to prepare a disk image for another Linode customer and transfer it to the separate account when it is needed.

Contents

Create Finnix Boot Profiles

On the sending side, click "Create a new Configuration Profile" and create a Finnix profile. Assign the disk image you wish to copy to xvdb in the profile.

Creating a Finnix recovery profile in the Linode Manager.

On the receiving side, create an empty disk image by clicking the "Create a new Disk Image" link on the dashboard, and make it as large as the image you want to receive.

Creating a blank disk image in the Linode Manager.

Create a Finnix profile on the receiving side, specifying the disk image you want to receive the data to as xvdb. NOTE: Please be sure to specify the correct disk image to avoid accidentally overwriting another image.

Creating a receiving Finnix configuration profile in the Linode Manager.

Copy the Disk Image

Use the "Reboot" button for the Finnix Recovery profile on each Linode to boot into the Finnix environment on both sides. On the "Console" tab in the Linode Manager for each Linode, click "AJAX Console" and you'll be presented with the Finnix environment.

Finnix running the Linode Manager AJAX console.

On the receiving side, set the root password and start the SSH server:

passwd
/etc/init.d/ssh start

Issue the following command on the sending side to start copying your disk image to the receiving Linode. Replace "12.34.56.78" with the receiving Linode's IP address.

dd if=/dev/xvdb | ssh -C 12.34.56.78 "dd of=/dev/xvdb"

You'll be presented with output similar to the following session excerpt. Note that it may take a long time to copy your disk image to the receiving machine.

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)? yes
Warning: Permanently added '12.34.56.78' (RSA) to the list of known hosts.
root@12.34.56.78's password:
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

Once the copy job has completed, you may wish to verify it by mounting the image on your receiving Linode. You may do so as follows:

root@hvc0:~$ mkdir linode
root@hvc0:~$ mount /dev/xvdb linode
root@hvc0:~$ ls linode/
bin   dev  home  lost+found  mnt  proc  sbin     srv  tmp  var
boot  etc  lib   media       opt  root  selinux  sys  usr

Congratulations! You've successfully transferred your Linode's disk image to another host over the Internet using SSH.

Creative Commons License

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

Last edited by Jed Smith on Thursday, April 28th, 2011 (r1038).