If you'd like to copy a Linode's disk image to a system that resides on a different network, you can easily do so using SSH from within Rescue Mode. This may be useful in cases where you'd like to periodically make complete offsite images of your Linode's disk image for backup/archival purposes.
In this example, we'll be copying a Linode's disk image to a local system over SSH. You'll need to make sure your receiving environment 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 compatiability layer to provide a reasonably complete Unix-like environment.
Contents
Refer to the Use Finnix Rescue Mode guide to get started by booting your Linode into Rescue Mode.
Make a note of the device that points to your main disk image. The default configuration maps /dev/xvda to your main disk image. If you choose to map your main disk image to another device, be sure to specify that device when running the "dd" command shown below.
Once booted into Rescue Mode, set the root password and start the SSH server:
passwd /etc/init.d/ssh start
Issue the following command to start copying your disk image to the receiving machine. Replace "archive" with an appropriate values for your receiving machine's configuration (this example assumes your local username is "archive"). Replace "12.34.56.78" with your Linode's IP address.
ssh root@12.34.56.78 "dd if=/dev/xvda " | dd of=/home/archive/linode.img
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 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 Warning: Permanently added '12.34.56.78' (RSA) to the list of known hosts. root@12.34.56.78's password: 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
Once the copy job has completed, you may wish to verify it by mounting the image on your receiving machine. You may do so as follows (on the receiving machine, named "backupbox" in this example):
archive@backupbox:~$ mkdir linode archive@backupbox:~$ su Password: backupbox:/home/archive# mount -o loop linode.img linode backupbox:/home/archive# 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.
This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.
Last edited by Christopher S. Aker on Sunday, November 20th, 2011 (r2714).
