My Seagate 4TB backup hard drive (LUKS+BTRFS) instructions.
- Never eject without safe unmount.
- Setup on the new machine to enable on-the-fly compression.
- De-duplication can save a lot of space.
- Snapshots are useful for rollback.
Edit fstab
:
$ sudo nano /etc/fstab
Add this line: (Note: zstd:15
is super slow but I think it is suitable for a backup medium)
/dev/disk/by-uuid/b2851dc0-ad02-423c-b828-2fae57109dfb /mnt/Salih4TB auto nosuid,nodev,nofail,x-gvfs-show,noatime,compress-force=zstd:15,noauto 0 0
Run to refresh mount info:
$ sudo mount -a
Unmount and mount the device again.
$ sudo compsize /mnt/Salih4TB
$ duperemove -dr --hashfile=/mnt/Salih4TB/.backup/duperemove.hash /mnt/Salih4TB
# Take a snapshot named with the current time
$ sudo btrfs subvolume snapshot -r /mnt/Salih4TB /mnt/Salih4TB/.snapshots/$(date +"%Y_%m_%d_%H_%M")
# Remove a snapshot
$ sudo btrfs subvolume delete /mnt/Salih4TB/.snapshots/2023_07_23_14_53
# Unmount the drive before the test
$ sudo badblocks -v /dev/sdb # read-only
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ sudo badblocks -vn /dev/sdb # read-write !!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Format the device with BTRFS + LUKS. After completing Setup on New Machine
...
$ mkdir /mnt/Salih4TB/.snapshots
$ sudo btrfs subvolume create /mnt/Salih4TB/.backup
$ sudo chattr +C /mnt/Salih4TB/.backup # noCOW
$ sudo chown $USER:$USER /mnt/Salih4TB/.backup