How Can I Copy My Disk to Block Storage?

Linode Staff

I want to delete my server but keep a backup of the disk around just in case I need the data later. How can I accomplish this?

1 Reply

Block storage is the perfect solution to allow you to preserve an image of your disks on our platform without needing to keep the full Linode around. To accomplish this, you will want to first create a block storage volume in the same data center as your Linode and attach it to your Linode. From there, boot the Linode into Rescue Mode ensuring that the Block Storage volume is in the /dev/sdc slot. From there you can run the following commands to copy the Linode's disks over to the Block Storage volume:

mkfs.ext4 "/dev/disk/by-id/scsi-0Linode_Volume_$volumelabel"
mount -o barrier=0 /dev/sdc
dd if=/dev/sda of=/media/sdc/linode.img

This will create a .img file on your block storage volume. From there you can power the Linode down and detach the block storage volume. Block Storage costs $0.10/GB per month and this will preserve the .img file until you need to use it again in the future.

To restore from the backup you will want to create a new Linode. First, deploy a swap disk to the Linode then create a blank ext4 formatted disk. Attach the block storage volume to the new Linode. Create a configuration profile for the Linode with the blank disk as /dev/sda, the swap disk as /dev/sdb and the block storage volume as /dev/sdc. Boot the Linode into Rescue Mode with the blank disk in /dev/sda and the Block Storage volume in /dev/sdc. From there you can run the following commands to restore the image to the blank disk:

mount -o barrier=0 /dev/sdc
 dd if=/media/sdc/linode.img of=/dev/sda

From there you can expand the filesystem if necessary then boot from the blank disk.

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