Back up Linux devices with Disk Image

What it's for

A Disk Image Protected Item backs up whole disks or partitions, so you can rebuild a Linux server or workstation after a disk failure, restore it as a virtual machine, or pull single files out of the image. This article covers what you need on a Linux device, which filesystems and volume types work, and how to make sure the backup is consistent.

Note: Disk Image is an add-on. For current pricing, contact support@magnusbox.com. For Windows devices, see Disk Image - Walkthrough.

Before you start

  • The Magnus Box Application must be installed on the Linux device and signed in to the client's user account. Disk Image on Linux needs Magnus Box 24.9.10 or later. See Linux Installation and Supported platforms and system requirements.
  • For a consistent backup of a disk that's in use, the device needs either LVM2 with free space in the volume group, or the snapshot driver (see Get a consistent snapshot).
  • Check the volume types below before you promise a client full-disk recovery.

Supported filesystems and volumes

Filesystem Supported Skips unused space
EXT4 Yes Yes, with kernel 4.12 or later
XFS Yes Yes, with kernel 4.12 or later
Other filesystems Yes No (the whole partition is backed up)
Volume type Supported What to select
Basic partitions (sdX, hdX, nvme) Yes The partition or disk
LVM2 Yes The logical volume (recommended) or the underlying disks
MD RAID Yes The RAID volume (recommended) or the underlying disks
dm-crypt / LUKS Yes The decrypted volume (recommended) or the encrypted volume
Optical drives (srX) Yes Only shown when a disc is inserted
Loop devices and RAM disks No Can't be selected
Btrfs, Bcache, ZFS Not tested Use a Files and Folders backup instead

Selecting the logical, RAID or decrypted volume rather than the raw disks also means you can use granular restore to pull single files out of the image later. See Restore single files from image and VM backups.

Get a consistent snapshot

For each selected partition, the backup app tries these methods in order to take a point-in-time snapshot:

  1. No mount points: if the partition isn't mounted, nothing is writing to it, so it's backed up as is.
  2. LVM2 snapshot: works when the partition is an LVM logical volume and its volume group has enough free space for a temporary snapshot volume. Standard and thin volume groups both work. If the volume group is completely full, this method fails until you shrink a volume to make room.
  3. Snapshot driver (backupsnap61): a kernel driver that can snapshot any block device. It supports Linux kernels 5.10 up to 6.13. On current versions it's downloaded and installed automatically through DKMS. That needs internet access to github.com and dl-cdn.alpinelinux.org, and a package repository for DKMS (on Red Hat-family systems, enable EPEL with dnf install epel-release). To opt out of the automatic install, create the file /etc/backup-tool/backupsnap-opt-out.

If one of these works, the backup is crash-consistent and unused space is skipped. If none works, the job log shows a warning and the partition is read while it's in use. That backup may be inconsistent if programs were writing to the disk, and it can't skip unused space.

Warning: Crash-consistent isn't the same as application-consistent. For databases on the server, add a database Protected Item as well, for example MySQL or MongoDB, or stop the service with a before command.

Steps

  1. In the Web Portal, go to Management Console > Users, click the client's user and select the Protected Items tab.
  2. Click Add protected item..., enter a Name: such as "contoso-web01 full image", select Disk Image and click Next >.
  3. On the Items tab, click the folder button (Browse Device for items). Choose All drives, or pick individual disks and partitions. Include the boot and EFI partitions if you may need to boot the image later.
  4. Leave Include unused disk sectors for forensic data recovery off unless you need deleted-file recovery. It makes backups much larger and slower.
  5. Add a schedule on the Schedule tab and check the Retention tab. See Backup schedules explained.
  6. Click Save, then click Run Backup... on the item's row to run the first backup.

Verify it worked

  • The job shows Success on the user's Protected Items tab and in Job Logs.
  • Open the job's report and check there's no warning that a snapshot couldn't be taken. If there is, fix LVM free space or the snapshot driver, then run the backup again.
  • Test a granular restore of one file. See Restore single files from image and VM backups.

How the image is stored and restored

The image is stored as VMDK files: one small descriptor for the whole disk plus one data file per partition. Partitions you didn't select show up as empty space, so a restored disk has its full original size. You can restore the image:

When you restore a smaller filesystem into a bigger partition, EXT4 and XFS filesystems are grown to fill it if the resize tools (resize2fs or xfs_growfs) are installed.

Troubleshooting

  • Warning that no snapshot could be taken: add free space to the LVM volume group, or check the kernel version (5.10 to 6.13) and internet access for the snapshot driver.
  • A disk or partition is missing from the list: loop devices and RAM disks can't be selected, and optical drives only appear with a disc inserted. If the partition layout changed, select the disk again.
  • The device shows as offline: see Linux client only shows as 'Offline' in user-profile 'Devices' tab.

Still stuck? Email support@magnusbox.com with the username, device name, distribution and kernel version (uname -r), and the job's date and time.

Related articles

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us