✓ Solved

How can I create a full disk copy of my Linode?

Linode Staff

While I know I can use the backup service for snapshots, how can I create a block level copy of my Linode as a backup to my backups?

1 Reply

✓ Best Answer

You should be able to do this with the Block Storage Service, but it will require some manual steps in order to get that to work.

Since you can mount and boot from Block Storage Volumes (BSVs), this would be a useful way of storing a 'golden image' of your Linode in a given state that could be quickly redeployed from or be used to overwrite an existing Linode's boot disk.

Below is an overview on how to create a 'golden' image with a Block Storage Volume, with additional resources and links to relevant documentation along the way:

  • Create a BSV that's the same size as the image you'll be creating, erring on the side of caution and oversizing it slightly (for 389 GB, 390-395GB should be more than enough).

  • Attach the BSV to the Linode. You won't have to do all the other steps to format it or add a partition table since it will just be overwritten afterwards anyway.

  • Reboot the Linode into Rescue Mode. This is so that you can image the entire disk to the BSV from a separate environment. Having the operating system off will also mean that you won't capture any unnecessary temp or process files that would otherwise be on a running system.

  • In Rescue Mode, you're going to identify the two disks (the Linode's disk and the BSV). You can run lsblk and check the disk sizes, which should correspond to each one, but they may have different drive letters (e.g. the Rescue Mode environment is probably going to allocate /dev/sda to itself, meaning that the other two disks are likely going to be /dev/sdb and /dev/sdc).

  • Once you've identified which is which, the hard part is done. From Rescue Mode, you can now run a dd command to write a block level image of the Linode's disk to the BSV. This will likely take a while, depending on the block size (BS) value you use. I tend to use 4 Megabytes, or 4M, but it's up to preference and environment. This section from our Copy Disk to SSH guide can be modified to do this:

Instead of:

ssh root@192.0.2.9 "dd if=/dev/sda " | dd of=/home/archive/linode.img status=progress

You would just:

dd if=/dev/[the drive letter that corresponds to the Linode's main disk from earlier] of=/dev/[the drive letter for the BSV]

It does not generate any messages or anything once it's ongoing, it will just return you to a prompt when it's done. This will likely take quite a while, so I would recommend leaving this running in the background for an hour or longer, depending on how large the disk is.

After all that is said and done, you should be able to reboot out of Rescue Mode and detach the BSV. If you ever end up needing to boot from it, you can follow these steps to do so, and you'll have a near carbon-copy of your Linode at the time it was imaged.

The nice thing about this process is that, despite how lengthy this process looks the first time around, it's like riding a bicycle. You could even follow the rest of the guide for copying a disk over SSH to get an offsite copy for safekeeping or deployment on another platform/bare metal, although that's beyond the scope of this post.

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