Friday, May 1, 2009

Creating a Truecrypt NTFS volume in both Ubuntu and OSX

I wanted to encrypt my external disk and I wanted it to work under Linux, Windows and OSX (read and write for all). To my mind the two obvious options were dmcrypt and truecrypt. Dmcrypt works nicely for my laptop but as far as I could find it only had one windows client (FreeOTFE) and no OSX client which pretty much left me with Truecrypt. I also needed a filesystem that worked well on all three OSs so NTFS was the best option largely due to ntfs-3g.

I ended up creating the encrypted volume under both Linux and OSX during some troubleshooting so here's how I did it in both OSs. Note: you only need to create the encrypted once in either Linux or OSX

The steps for Linux (Ubuntu 8.10):
  • Install Truecrypt (grab the .deb and install that)
  • truecrypt -t -c /dev/sdc (create the encrypted volume - choose "None" for the file system)
  • truecrypt -t --filesystem=none /dev/sdc (mount the volume)
  • mkfs.ntfs -f -L Cams_1Tb /dev/mapper/truecrypt1 (format the volume as ntfs)
Then you should be able to mount the volume either via the gui or the command line and have it automatically mount without problem

The steps for OS X (Leopard):

  • Install Truecrypt
  • Install ntfs-3g for mac
  • I also installed MacFuse 2.0 at one stage following on from some forums posts but this may not be necessary (Truecrypt 6.1a installs MacFuse 1.6 or 1.7)
  • /Applications/ -t --filesystem=fat -c /dev/rdisk2 (fat seemed to work better than no file system at all)
  • Mount the Volume in Truecrypt and look at the "Volume Properties" on the newly attached volume. Take note of the "Virtual Device" in my case this was /dev/disk5
  • sudo diskutil eraseVolume NTFS-3G Cams_1Tb /dev/disk5 (convert the FAT volume to NTFS)
From here on end mounting and dismounting the device in Truecrypt should work a charm.