Linux - Encrypt an External USB Drive (with dm-crypt and LUKS) Date - February 10, 2011 Note - dm-crypt with LUKS leaves an identifiable header on the partition. ------------------------------------------------------- 1. Urandom the drive and then fdisk it. Example assumes /dev/sdc is external disk. dd if=/dev/urandom of=/dev/sdc bs=1M fdisk /dev/sdc 2. Initialize the encrypted LUKS partition and set the initial key. cryptsetup --verbose --verify-passphrase luksFormat /dev/sdc1 3. Open the encrypted LUKS partition and map it to /dev/mapper/stick cryptsetup luksOpen /dev/sdc1 stick 4. Create a file system on the encrypted LUKS partition mkfs.ext3 -j /dev/mapper/stick 5. Mount the encrypted LUKS partition mkdir /mnt/stick mount /dev/mapper/stick /mnt/stick 6. Umount and close the encrypted LUKS partition umount /dev/mapper/stick cryptsetup luksClose /dev/mapper/stick ------------------------------------------------------- For day to day use To Mount cryptsetup luksOpen /dev/sdc1 stick && mount /dev/mapper/stick /mnt/stick To Unmount cd ~ && umount /dev/mapper/stick && cryptsetup luksClose /dev/mapper/stick ------------------------------------------------------- Copyright 2011 '16 Systems'. All rights reserved. End