Restore an image created with dd

Hi,

I've set up a server backup using dd on a cron from the backup server:

cd /backup_images && ssh root@south.myhostcom "dd if=/dev/sda | gzip -1 -" | dd of=south.gz

This backs up the server fine as a image (I'm aware that some stuff may be corrupted due to this being run on a live server, but I also have incremental backups of the DB's and files running via another backup tool).

The thing I want to test now - is a restore. Could someone please explain how you do this? Create a new linode in the same size, upload the image file to it, and then?

Thanks!

2 Replies

Use the Rescue boot.

The rescue boot os has ssh and dd so you can use that to copy over your image to your Linode's disk! Rescue does not boot from your Linode's disk but allows it be available.

You will need to configure the Linode's disk to have two seperate disks. This can be done by resizing the disk down leaving room for another disk. This will let you copy the image to say, /dev/sdc and then using dd install the image from there to /dev/sda. As long as you have enough space for that you can remove sdc and add it's storage back to sda later.

Here's a guide. I didn't follow the steps exactly but it helped me figure it out
https://www.linode.com/docs/guides/install-a-custom-distribution-on-a-linode/

Hey @youradds. Our Copy a Disk Over SSH guide has these steps laid out for you! Here's the basic process for a quick rundown:

  • Create a new Linode with enough disk space to accommodate your backup image
  • Once the Linode has finished deploying, delete your primary disk while leaving your swap disk intact
  • After the primary disk has been deleted, create an empty disk in its place
  • Reboot the Linode into Rescue Mode and upload your backup image via SSH:
 dd if=/home/archive/linode.img | ssh root@192.0.2.9 "dd of=/dev/sda"

The important thing here is to make sure you're copying your backup image to an empty disk. Rescue Mode will ensure that you're working in a secure environment while you upload your image.

After the upload has finished, go through the rest of the steps in the guide I linked above (expanding your file system if necessary, booting from your disk), and you should be good to go.

If you're interested, there's another Community post that talks about this process in the context of saving your data locally in order to reduce billing for inactive services: What is a good way to delete my Linode so I don't get charged, but still save my Linode's configuration and data?

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