Created
March 2, 2015 16:21
-
-
Save nitmir/fd1041fbeef24e7f30ac to your computer and use it in GitHub Desktop.
Backup all luks header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function backupdev () { | |
DEV=$1 | |
if cryptsetup isLuks $DEV 2>/dev/null; then | |
DEVNAME=$(basename $DEV) | |
echo "Backup $DEV" | |
cryptsetup luksHeaderBackup $DEV --header-backup-file "luksHeaderBackup_${HOSTNAME}_${DEVNAME}.bin" | |
fi; | |
} | |
for dev in $(lshw -quiet -short -class disk -class volume | awk '{print $2}'); do | |
backupdev $dev | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment