ZFS Snapshots for MDT backup
Backing up your MDT using zfs snapshots
ZFS snapshots are an easy and lightweight way to backup or migrate your MDT(s) (and OSTs!) to different servers. The process is fairly straight forward:
- Take a snapshot of the MDT dataset
- Send the snapshot to another pool/system making sure to use the -p switch on the zfs send command.
example of a resume-able snapshot send to a remote system using ssh:
(You will likely want to use the -s switch on your recv command to support resuming the send if it gets interrupted for some reason.)
zfs snap mdt-pool-000/mdt-0000@backup-20251022 zfs send -vp mdt-pool-000/mdt-0000@backup-20251022 | ssh [email protected] 'zfs recv -s backup-pool/mdt-0000'
That's it. You may notice your MDT consuming more (or less) space depending on the pool geometry of the pool you've sent it to.
Restoring your MDT from a backup snapshot
Assuming you are restoring to a machine that will have the same nid(s) as the machine the mdt came from the process should be very straight forward:
- have or create a pool on the new host that is configured as desired
- send snapshot from backup pool to production pool making sure you use the -p switch for the send command.
- start the mdt (if desired)
example of a resume-able snapshot send from a remote system using ssh:
# this assumes that the pool mdt-pool-000 exists on the system and that there is not presently a dataset called mdt-0000 on it ssh [email protected] 'zfs send -p backup-pool/mdt-0000@backup-20251022' | zfs recv -vs mdt-pool-000/mdt-0000
If you are restoring to a machine that has a different nid from the machine the MDT was originally on you'll likely need to follow the process for changing server nids in the lustre manual.
Note about backups and restoration
Any restoration of a MDT from a snapshot is going to be of the MDT at the point in time the snapshot was created. It is highly likely that unless you also took snapshots of your OSTs at the exact same time as the MDT(s) and restored everything at the same time that the MDT(s) and OSTs will be inconsistent. You will likely have orphaned or missing objects on the OSTs. You should run a lfsck after any restoration.
While it may not meet the definition of a backup, just taking snapshots (but not sending them anywhere) on your MDT(s) (and OSTs) can give you a mechanism for rolling back the filesystem should you need to, like due to difficulties during an upgrade for example.