您的位置:首页 > Web前端 > Node.js

复制linode镜像

2011-02-06 17:18 92 查看

Copy a Disk Image Over SSH

Published: August 13, 2009 by Phil ParadisIf 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 and a Finnix configuration profile. 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 environmnet.

These instructions work with the Linode platform. If you don't have a Linode yet, sign up for a Linux VPS and get started today.

ContentsCreate a Finnix Boot ProfileCopy the Disk ImageLicense

Create a Finnix Boot Profile

Under your Linode's "Dashboard" tab, click "Create a new Configuration Profile".



Create a configuration profile for Finnix using the values shown below. In this example, we've mounted our Linode's disk image on /dev/xvdb. Once you've selected the correct values, click "Save Profile" to continue.



Use the "Reboot" button for the Finnix Recovery profile to boot into the Finnix environment.



On the "Console" tab in the Linode Manager, click "AJAX Console" and you'll be presented with the Finnix environment.



Set the root password and start the SSH server:

passwd
/etc/init.d/ssh start

Copy the Disk Image

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/xvdb | cat" | 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.

License

This guide is licensed under a Creative Commons Attribution-No Derivative Works 3.0 United States License

. Please feel free to redistribute unmodified copies of it as long as attribution is provided, preferably via a link to this page.

http://library.linode.com/linode-platform/migration/copy-disk-image-over-ssh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: