Skip to content

Instantly share code, notes, and snippets.

@zuloo
Last active Aug 29, 2015
Embed
What would you like to do?
Bash Command 4 Luks Header Backup
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