dmcrypt - open encrypted drive with key

From thelinuxwiki
Jump to: navigation, search

configure you box to open the partition / disk using a key

example using gentoo

   mybox home # vi /etc/conf.d/dmcrypt 

added lines...

   target=home
   source='/dev/sdb1'
   key='/root/hdpw'
      • the following took a long time...
 mybox home # dd if=/dev/random of=/root/hdpw
    bs=1 count=512
    512+0 records in
    512+0 records out
    512 bytes (512 B) copied, 2821.2 s, 0.0 kB/s
  mybox home # chmod 400 /root/hdpw
  mybox home # cryptsetup luksAddKey /dev/sdb1 /root/hdpw
Enter any passphrase: 

All done, test with a reboot.