It seems like this script no longer works for array devices in unraid 7. The tl;dr is that for the array, the /dev/md* devices should be targeted instead. For cache pool (at least for btrfs), things still seems to work. Just changing the pattern to include /dev/md* wont' work, as this fails when udevadm gathers data about the device. I'll see if there's a way to correlate the md devices with the real device ID sometime later. I'm wondering if there's anything preventing using lsblk to query for devices and filtering with isLuks, e.g. for device in `lsblk -o path -ln`; do
if cryptsetup isLuks $device; then
...This would help the script being less susceptible to arbitrary changes to where devices are located. Below is the process I went through I was curious about whether the /dev/md* devices would yield the same result as /dev/sd* did previously. # stop the array first
## cache pool (btrfs)
cryptsetup luksHeaderBackup /dev/sdb1 --header-backup-file luks-sdb1.bin
cryptsetup luksHeaderBackup /dev/sdc1 --header-backup-file luks-sdc1.bin
cryptsetup luksHeaderBackup /dev/nvme0n1p1 --header-backup-file luks-nvme0n1p1.bin
## array (xfs)
cryptsetup luksHeaderBackup /dev/sdd5 --header-backup-file luks-sdd5.bin
cryptsetup luksHeaderBackup /dev/sde1 --header-backup-file luks-sde1.bin
cryptsetup luksHeaderBackup /dev/sdf1 --header-backup-file luks-sdf1.bin
# after starting the array again
for md in /dev/md*; do
cryptsetup luksHeaderBackup $md --header-backup-file "luks-`basename $md`.bin";
done I confirmed that the files are identical using cmp, the hashes just made it easy to confirm if any were close enough to bother checking. shasum luks*.bin | sort
5ad508c36ea8373a09e5abba49a8685f89464b33 luks-nvme0n1p1.bin
60c879daae36ccdef2f02413a74f03ccb75104a3 luks-sdb1.bin
814856d2565da05f65a7b244a3bc622b47972cec luks-md2p1.bin
814856d2565da05f65a7b244a3bc622b47972cec luks-sde1.bin
91e68de3533b697c4e7542c42661af3312968ecf luks-md1p1.bin
91e68de3533b697c4e7542c42661af3312968ecf luks-sdd5.bin
a44b321e6b3e421c35fba5b93a2d8ae6130e9504 luks-sdc1.bin
e5585bf7ddddfdd8c4160073b6f8f1c1a31581c7 luks-md3p1.bin
e5585bf7ddddfdd8c4160073b6f8f1c1a31581c7 luks-sdf1.binThis matches the six encrypted disks in my server. I feel recently confident about taking the luks headers from the md devices.