Create Encrypted Partition

I use encrypted partitions on all my external hard disks.  This is how I did it:

  1. Install the cryptsetup package.
  2. # aptitude install cryptsetup

  3. Create a partition on the empty external hard disk. Assume the device name is /dev/sdb
  4. # cfdisk /dev/sdb

  5. Setup the encryption on the partition created.  The device name for my newly created partition is /dev/sdb1.  During the setup, you’ll be prompted to give a password to decrypt the partition.
  6. # cryptsetup luksFormat /dev/sdb1
    # cryptsetup luksOpen /dev/sdb1 tempName

  7. Create an extended-3 filesystem.
  8. # mkfs.ext3 /dev/mapper/tempName

  9. Give it a volume name. Mine is called “EXT-80GB”
  10. # tune2fs -L EXT-80GB /dev/mapper/tempName

  11. Close the encrypted partition.
  12. # cryptsetup luksClose tempName

  13. Encryption setup is now completed.  Unplug and plug in the external hard disk, pmount will detect it.  You’ll be prompted to key in your password to decrypt the partition.
  14. End.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: