Default style version .::. Minimal style version

LUKS encryption

Installing and encrypting the drive

  1. Install the required packages:
    apt-get update
    apt-get upgrade
    apt-get install cryptsetup
    Note: This will also install dmsetup and suggest dosfstools.
  2. If using only part of the drive, repartition with cfdisk and then, in the commands below, use the partition instead of the drive.
  3. Overwrite the drive with random data:
    dd if=/dev/urandom of=/dev/<drive>
    The method above takes some time. For a quicker but slightly less secure method, use:
    badblocks -c 10240 -s -w -t random -v /dev/<drive>
  4. Create the encrypted partition:
    cryptsetup luksFormat /dev/<drive>
    Note: If the error "failed to setup dm-crypt key mapping" occurs, try:
    modprobe dm-crypt
    If this fails, a reboot should solve the error.
  5. Map the encrypted partition:
    cryptsetup luksOpen /dev/<drive> <hddname>
    Note: <hddname> can be anything you like.
  6. Create a file system on the encrypted partition:
    mkfs.ext3 /dev/mapper/<hddname>
  7. Create a mount point:
    mkdir /mnt/<hddname>
  8. Mount the partition:
    mount /dev/mapper/<hddname> /mnt/<hddname>

Using the encrypted partition (post installation)

Mounting:

cryptsetup luksOpen /dev/<drive> <hddname>
Enter LUKS passphrase when prompted
mount /dev/mapper/<hddname> /mnt/<hddname>

Disconnecting:

umount /mnt/<hddname>
cryptsetup luksClose /dev/mapper/<hddname>

Go back to the How-to Guides main page.

Search

Starter website

Offering small businesses and individual users the opportunity to have their own website on the internet, our 'starter websites' are available for only £150.

new site offer

To find out more and to see an example of the type of site offered, view our example starter website page.