Last active
August 29, 2015 14:08
-
-
Save zuloo/12b645f25ec42de396ad to your computer and use it in GitHub Desktop.
Bash Command 4 Luks Header Backup
This file contains 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
cat /etc/crypttab |\ | |
grep uuid |\ | |
sed -r 's/[\t ]+/ /g' |\ | |
cut -d ' ' -f 2 |\ | |
while read line; do | |
dev=$(ls -la $line); | |
ser=$(smartctl -a $line | grep 'Serial Number'); | |
cryptsetup \ | |
luksHeaderBackup /dev/${dev##*/} \ | |
--header-backup-file \ | |
/mnt/usb/luks-header_${ser##* }_$(( 0 + 0${dev##*/sd[a-z]} )); | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment