Restore an image created with dd
I've set up a server backup using
dd on a cron from the backup server:
cd /backup_images && ssh [email protected] "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?
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
- 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 [email protected] "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?