Skip to content

2019 10 25 Electra backup

bbahiam edited this page Oct 30, 2019 · 4 revisions

The backup is comprised of two identical packages containing:

  • One 8TB external hard drive
  • One 250GB SSD
Backup 1 Backup 2
$ ls -lh /mnt/bk
total 80G
-r--r--r-- 1 root root  218 Oct 20 16:50 bk1_audit.txt
drwxr-xr-x 9 root root  140 Oct 20 00:11 RAID1storage
-r--r--r-- 1 root root   92 Oct 20 01:23 RAID1storage_hashdeep.sha256
-r--r--r-- 1 root root 1.1G Oct 20 00:46 RAID1storage_hashdeep.txt
-r--r--r-- 1 root root  79G Oct 20 02:04 root.dump0
-r--r--r-- 1 root root   77 Oct 20 18:47 root.dump0.sha256

Instructions to reproduce backup

System backup

Just do a dd of the disks, e.g.

   dd if="/dev/disk/by-id/<original-disk-id>" of="/dev/disk/by-id/<backup-disk-id>"

be careful to not write to the original disk while doing this. The best way is to set the filesystem to read only mode, i.e. by booting in recovery mode.

RAID array (user data) backup

External HDs for backup were connected and mapped to /dev/sdc and /dev/sdd.

  1. Set backup target to read-only
   # mount -o remount,ro /media/RAID1storage
  1. Wipe factory partition tables on the new drives
  # sgdisk --zap-all /dev/sdc
  # sgdisk --zap-all /dev/sdd
  1. Create new partitions
  # sgdisk -n1:1M: /dev/sdc
  # sgdisk -n1:1M: /dev/sdd
  1. Format to XFS, to mirror the RAID format (
  # mkfs.xfs -f /dev/sdc1
  # mkfs.xfs -f /dev/sdd1

-f is needed because the disks came formatted from factory

  1. Mounted new partition and create directories for replication
  # mount /dev/sdc1 /media/bk1
  # mount /dev/sdd1 /media/bk2
  # mkdir /media/bk1/RAID1storage
  # mkdir /media/bk2/RAID1storage
  1. dump and restore the file system to both drives in parallel
  # nohup bash -c "xfsdump -l0 -J - /dev/sdb1 | tee >(xfsrestore -J - /media/bk1/RAID1storage/) >(xfsrestore -J - /media/bk2/RAID1storage/) >/dev/null" &
  1. Audit backup using hashdeep

Generate file hashes

   # cd /media && hashdeep -lr RAID1storage/ > ~/RAID1storage_hashdeep.txt &

Audit backups and originial file system

   # cd /media/bk1 && hashdeep -j0 -vv -lark ~/RAID1storage_hashdeep.txt RAID1storage/ > ~/bk1_audit.txt &
   # cd /media/bk2 && hashdeep -j0 -vv -lark ~/RAID1storage_hashdeep.txt RAID1storage/ > ~/bk2_audit.txt &
   # cd /media && hashdeep -j0 -vv -lark ~/RAID1storage_hashdeep.txt RAID1storage/ > ~/RAID1storage_audit.txt &