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?

2 Replies

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.

@scrane
I'm having difficulty following this instruction:

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 <<

I have been able to create a block storage volume in the same data centre as the Linode I'm using.

I have been able to attach the volume to the linode and rebooted into Rescue mode. I have selected the block storage volume into /dev/sdc.

I ran up the Lish console to this:
root@finnix:~#

And pasted in mkfs.ext4 "/dev/disk/by-id/scsi-0Linode_Volume_dbconnectsLive"

This resulted in 11 lines ending in:
"Writing superblocks and filesystem accounting information: done"

I then ran:
mount -o barrier=0 /dev/sdc

Which errored with:
mount: /dev/sdc: can't find in /etc/fstab

The only thing I can think of that when I created the new volume I did not create the Volume Configuration detail as in:

"To get started with a new volume, you’ll want to create a filesystem on it:"

mkfs.ext4 "/dev/disk/by-id/scsi-0Linode_Volume_dbconnectsLive"

mkdir "/mnt/dbconnectsLive"

mount "/dev/disk/by-id/scsi-0Linode_Volume_dbconnectsLive" "/mnt/dbconnectsLive"

Is this the trouble?

All help is appreciated.
Regards
Bernard

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