You can use SSH to copy a Linode's disk image to a system that resides on a different network. This is an effective way to back up your Linode's disk images to a personal computer or another server. In this guide, you'll learn how to use SSH to copy a Linode's disk image to a local system.
Verify that the receiving computer has SSH installed. (Most Linux/Unix-like systems have it installed by default.) If you're running Windows locally, you may wish to set up the Cygwin compatibility layer to provide a reasonably complete Unix-like environment.
Before you initiate the transfer, start your Linode in Rescue Mode and start SSH. Here's how:
Now that the Linode is running in Rescue Mode, you can transfer the disk image from the Linode to the receiving machine. Here's how to copy a disk image over SSH:
Enter the following command on the receiving machine. Replace 220.127.116.11 with the Linode's IP address and /home/archive/linode.img with the path where you want to store the disk image:
ssh email@example.com "dd if=/dev/xvda " | dd of=/home/archive/linode.img
The receiving machine will connect to the Linode. Type yes and press Enter to continue connecting:
The authenticity of host '18.104.22.168 (22.214.171.124)' can't be established. RSA key fingerprint is 39:6b:eb:05:f1:28:95:f0:da:63:17:9e:6b:6b:11:4a. Are you sure you want to continue connecting (yes/no)? yes
Enter the root password for the Linode, as shown below
Warning: Permanently added '126.96.36.199' (RSA) to the list of known hosts. firstname.lastname@example.org's password:
The transfer starts. You'll see output similar to the following.
4096000+0 records in 4096000+0 records out 2097152000 bytes (2.1 GB) copied, 371.632 seconds, 5.6 MB/s 4096000+0 records in 4096000+0 records out 2097152000 bytes (2.1 GB) copied, 364.002 s, 5.8 MB/s
Note that copying your disk image can take a while. Be patient!
Once the copy has completed, you can verify it by mounting the image on the receiving machine. Here's how:
Log in to the receiving machine as root by entering the following command and entering the root user's password:
Make a directory on the receiving machine by entering the following command:
Mount the disk image by entering the following command, replacing linode.img with the name of the disk image:
mount -o loop linode.img linode
View the directories stored on the disk image by entering the following command:
You should see the directories on the disk images, similar to the ones shown below:
bin dev home lost+found mnt proc sbin srv tmp var boot etc lib media opt root selinux sys usr
You have successfully transferred your Linode's disk image to another host using SSH.
This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.
Last edited by Matthew Cone on Tuesday, June 5th, 2012 (r2910).