How to copy a bootable disk image from one Linode to another

I recently wanted to perform a clean upgrade to Debian 4.0 with minimal downtime. I did this by renting a second Linode (call it Linode B), configuring my Debian image there (call it disk 'src'), and copying it over to my main Linode as a bootable disk image (call it Linode A). Here's an expansion on anderiv's information to guide anyone else wanting to do this. YMMV.

Starting with Linode B..

1. Once you've completed work on 'src' on Linode B, check the amount of disk space in use on it and shut down the Linode.

2. Resize the disk image based on how much space is in use (eg. if you have used 200MB, resize it to 220MB). When the copying takes place, the entire disk image is copied rather than just the useful data, so this will save time.

3. Create a new Finnix profile on Linode B using the information in caker's thread here.

4. Assign /dev/ubdb to your 'src' disk image by editing the Finnix profile.

5. Boot Linode B into Finnix and log into it using Lish (SSH into your hostXX.linode.com machine with your Linode.com credentials, and hit enter to get into the screen session).

Moving onto Linode A..

6. Log into the web interface and create a new disk image on Linode A - it should be ext3 and the same size as the 'src' image in step 2.

7. Assign the disk image to /dev/ubdh (or whichever device is free) in your profile on Linode A.

8. Reboot Linode A.

Back to Linode B..

9. In your Finnix session, enter the following command:

dd if=/dev/ubdb | ssh -p 22 -c blowfish root@linodeA dd of=/dev/ubdh

Replace the SSH port if Linode A's SSH runs on something other than 22 and be sure to replace 'linodeA' with Linode A's real IP address. Also replace /dev/ubdh if you did not use it in step 7 - triple check this to ensure you do not overwrite the wrong disk image.

10. Play some UT2004 whilst waiting for this to complete - in my case transferring between two hosts at Atlanta took place at a surprisingly slow 400k/sec. Obviously the speed is not too important as there is no downtime whilst this process is taking place, but you can monitor the speed anyway using iftop.

Back to Linode A..

11. Once complete your disk image should now be accessible from Linode A:

mkdir /mnt/newimage
mount /dev/ubdh /mnt/newimage
ls -al /mnt/newimage

12. At this point you may want to make some changes to your new image to ensure that it is bootable. I modified /etc/network/interfaces to reflect the IPs of Linode A (I use static addressing) and also /etc/hostname. This is also a good time to transfer data to the new image.

13. You can then go ahead and use this disk image in a new configuration profile on Linode A, or simply change your current profile to use the new image.

I'm sure there are improvements that can be made to this process, but it worked like a charm for me and I hope it helps others :)

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct