Making an encrypted partition on a USB drive

On Ubuntu or Debian, it’s really simple to create an encrypted partition on a newly-purchased USB mass storage device.  In my case, I had bought a 1TB hard drive which had very mixed reviews, some people saying their drives had failed very early.  I wanted to be able to return the drive under warranty if it broke without worrying about personal data.

It turns out that if you want to reformat a partition on an external USB drive so that it’s encrypted, this is just a matter of doing the following:

sudo luksformat -t ext4 /dev/partitiondevice

…. where /dev/partitiondevice is the device for the drive partition you want to overwrite.  Obviously, this will destroy everything that was previously on that partition.

I like to use a proper filesystem for USB mass storage devices, but if you leave out the -t ext4 then the default is to use VFAT.

When you next plug in that drive, you’ll be prompted to enter the password that you picked when creating the partition – if you type that correctly, the drive will be mounted and usable.  (If you mistype it, you’re not given another chance to enter the password, so you’ll need to go to the command line and do: gvfs-mount -d /dev/partitiondevice to try again.)

One small thing is that the mount point in /media will be based on a UUID by default, but if you set the ext4 partition label, it’ll be mounted under that name in /media/ instead.  To do this, starting from when your disk is mounted, you can run mount without parameters to find the unencrypted device name and then unmount it and change the label:

$ umount /dev/mapper/udisks-luks-uuid-b7bbb2c8-etc
$ e2label /dev/mapper/udisks-luks-uuid-b7bbb2c8-etc topsekrit

If you unplug and plug in the disk again, it should be mounted on /media/topsekrit


Posted

in

,

by

Tags:

Comments

One response to “Making an encrypted partition on a USB drive”

  1. Muhammad Avatar

    wrote:Thats true, the weird thing is when I take out my XT sim and put in my Vodafone sim, everything fixes ieltsf. It makes me wonder who is not following the proper standards, if there are any standards. Knowing the reputations of Apple and Telecom, the natural reaction is that Telecom is going take most of the bashing lol regardless of whose fault it is.(koruki has made 2 comments)Yes, because Vodafone are an official carrier. The problem *only occurs* when you insert a SIM card from an unofficial carrier. It has nothing to do with proper standards at all. The simple matter of fact is that when you put in a SIM card from an official carrier, the phone does different things to when you put in a SIM card from an unofficial carrier.In this case, it would appear that the things that the phone does when you have an unofficial carrier’s SIM card in results in a bug appearing. As mentioned above Apple are working on the problem and one would hope the problem is fixed in 5.0.1. I don’t see how Telecom should be taking any blame at all given that they have never sold the device, don’t support the device, and no other devices on their network exhibit the same problem.FWIW I cannot see how this could be the fault of Telecom. The bit that isn’t working is the part where the phone matches numbers to names. The carrier has no involvement in this process, not from a network level and not from a SIM card level. It is all in the phone software. The *only* way this could possibly be happening is if Apple has started relying on some weird field in the SIM card for some crucial piece of information, but I highly doubt this is the case this time around.As mentioned above, Apple are aware of the issue and they are working on a fix. That is all. Any anger towards Telecom is severely misdirected as there is so far absolutely no evidence that this has anything to do with their actions or inactions. In all likelihood Apple will fix the problem in a subsequent update without Telecom lifting a finger.(rdw11 has made 15 comments)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.