Try Tuts+ Premium, Get Cash Back!
How to Set Up and Use FileVault 2

How to Set Up and Use FileVault 2

Tutorial Details
  • Topics: Security, Encryption
  • Difficulty: Intermediate
  • Estimated Completion Time: 30 Minutes

There are a number of different ways to keep unwanted people out of your Mac as well as your files encrypted. In this tutorial, we’ll be discussing the king of Mac encryption, FileVault 2.

What is FileVault?

FileVault was a method of automatically encrypting your data that Apple introduced back with OS X 10.3 (Panther). It worked by encrypting and decrypting the user’s home folder. When you logged out of your Mac, OS X would encrypt the contents of your home folder to what’s called a “sparse image” – an encrypted disk image that only took up the space it needed to. A limitation of traditional disk images – DMGs – is that they have to have a specified file size. Since you can’t predict how much space you’ll use, sparse images are used instead.

FileVault was created specifically for portable Mac users where sensitive information was being kept. FileVault doesn’t protect against poor passwords or leaving your computer unattended – it’s designed to make sure that if your portable Mac was to be lost or stolen, the contents of the drive remain private.

FileVault was probably the scariest of all the system preferences. Look at that red writing! Thankfully, FileVault 2 has much less a reason to be scary!
FileVault was probably the scariest of all the System Preferences. Thankfully, FileVault 2 is much friendlier.

VileFault

Historically, FileVault was slow, clunky and unreliable. For starters, it would only encrypt home directories – the rest of the Mac was unencrypted.

FileVault was also notoriously unreliable (coining the term “VileFault”) and if your Mac experienced some problems (such as installation issues) then it was more likely that your home folder would no longer decrypt. If you had a lot of data on a fairly old Mac, you could be waiting a long time for your Mac to log in and out. Many users would become impatient and just power the Mac off while it was logging out (and encrypting), hence damaging the sparse bundle and destroying FileVault.

Worse still, although “compatible” with FileVault, Time Machine could only back up the sparse bundle once you were logged out. Since Time Machine didn’t support disk encryption, it would not backup data while you were logged in (since it would defeat the purpose of encryption in the first place).

FileVault would allow the user to (optionally) set a master password. Making it optional was, in hindsight, a monumentally bad idea. If you forgot your password and didn’t have a master password set (or forgot that to), you lost your data. There was no way to get that back.

FileVault was one of the only features of OS X I actively encouraged people not to use. Until now.

FileVault 2

With the introduction of Lion, Apple completely overhauled FileVault and even made it a sequel – FileVault 2! FileVault 2 operates completely differently from FileVault. It also encrypts the entire hard disk.

FileVault was created specifically for portable Mac users where sensitive information was being kept. FileVault doesn’t protect against poor passwords or leaving your computer unattended.

Unlike before where FileVault encrypted data could be corrupted in some way, FileVault 2 manages encryption and decryption in a different way. All username and password information is stored in a dedicated portion of the hard drive that’s unencrypted (but the data itself is protected). Instead of the usual OS X login window after your Mac is booted, the login window is the first thing you see. Your Mac requires your password before it can boot. Once you’ve logged in and your Mac verifies your password is correct, only then does your Mac boot. You won’t see the login window again, the first one takes care of that for you.

Tip: How exactly FileVault 2 encrypts and decrypts your data goes way beyond the scope of this tutorial but a great guide over at AFP548 shows in detail how the encryption works.

The beauty of FileVault 2 is that there is no overhead or performance compromise. I have been using FileVault 2 since I got my MacBook Air a few months ago and have two USB hard drives that are both encrypted. Overkill? Probably. But since it has no affect on the performance or reliability, I’ve been happily using it.

How to Enable Turn FileVault 2

Before we begin, FileVault 2 requires Lion or Mountain Lion and you must have your recovery system unchanged. If you’ve removed it, you won’t be able to use FileVault 2.

  1. Open System Preferences and select Security and Privacy.
  2. Select FileVault and then click Turn On FileVault

If you have multiple users, you can specify which users will be allowed to decrypt the disk. Let’s say you have 2 users on your Mac, you could be the one that logs in and decrypts but the other user can only login once you’ve logged in already.

You can specify which users will be allowed to decrypt the disk when booting your Mac
You can specify which users will be allowed to decrypt the disk when booting your Mac

Once you’ve entered your password and confirmed, you are presented with FileVault 2’s version of the master password – called the recovery key. This is absolutely crucial to keep safe, so crucial that Apple even offers to store it on their servers so that in the event you lose or misplace it, you can contact Apple to access your drive.

The recovery key is provided if you forget your password. Make sure to keep it secret, keep it safe!
The recovery key is provided if you forget your password. Keep it secret, keep it safe!

Tip: I recommend storing your recovery key in an app such as 1Password which encrypts data as long as you are able to access it through another computer or iOS device. Remember, storing this key on your computer is pointless if you can’t log in!

Unless your company has a strict policy on the storage of encryption keys, it’s recommended to allow Apple to store it. They can’t decrypt it remotely and require a number of security questions and answers to be created by you. It’s not attached to any Apple ID or iCloud account.

You can store the recovery key with Apple
You can store the recovery key with Apple…
 but you’ll need to specify three security questions and answers.
…but you’ll need to specify three security questions and answers.

Tip: As with many security questions (such as name of your first pet) it’s actually better security to provide fake answers only you will know since a lot of this information can sometimes be easily found. Again, make sure they’re answers you’ll remember but there’s nothing wrong with saying your mother’s maiden name was Skywalker or Calrissian!

Activating FileVault 2

Once you’ve completed the setup, you will need to restart your Mac. It can take some time to encrypt the disk so make sure your Mac is plugged in to the mains if it’s a portable.

Once you’ve set up FileVault, make sure you’re not going to need your Mac for a while, it can take some time to complete.
Once you’ve set up FileVault, make sure you’re not going to need your Mac for a while, it can take some time to complete.

Tip: For best results, make FileVault 2 the first thing you enable when buying a new Mac.

Disabling FileVault 2

If you want to disable FileVault 2, you can do so again through System Preferences and Security and Privacy. Once you’ve confirmed with your password, your Mac will decrypt your hard drive.

You can disable FileVault 2 at any time
You can disable FileVault 2 at any time

Time Machine

Along with FileVault 2, Lion also introduced encrypted Time Machine backups. This works in a similar (but simpler way) to FileVault 2.

  1. Open System Preferences and then select Time Machine
  2. Click Select Disk…
  3. From there, select the drive you’d like to use and tick Encrypt Disk
Time Machine lets you encrypt any external drive for Time Machine use, making sure your backup is as protected as your Mac
Time Machine lets you encrypt any external drive for Time Machine use, making sure your backup is as protected as your Mac

Time Machine will then prompt you to enter a password to encrypt the disk with. Once confirmed, it will begin encrypting the hard drive and set up a Time Machine backup.

Time Machine can also take a long time to encrypt the drive depending on speed and size
Time Machine can also take a long time to encrypt the drive depending on speed and size

Tip: Time Machine encryption is actually just a way of creating an encrypted disk. You can encrypt any external hard drive through Disk Utility.

Wrapping Up

As more and more of us switch to portable Macs instead of desktop units, we’re more inclined to take them out of the house. This means an increase in the chance of loss or theft. FileVault 2 will make sure that no one can access the data should it fall into the wrong hands.

But remember, all that protection is nothing if you set your password to something easy to guess or figure out. At the end of the day, the weakest link in any security system is human interaction. Some of the greatest hacks performed haven’t been by figuring out ways to bypass security systems, it’s through educated guessing and social engineering – the method of manipulating someone into providing them with the correct information. Make sure your password is a mixture of upper and lower case, numbers and symbols. Memorize it, but don’t use something memorable.

Tip: Apple has a full support document on FileVault 2 for further information.

FileVault 2 is a completely transparent and no-overhead encryption solution. It works so well that I’d recommend anyone to use it as long as they make sure they encrypt their Time Machine backups too.

Do you use FileVault 2? How have you found it? As always, we’d love to hear from our readers so post a comment!

Jordan Merrick is jordanmerrick on Themeforest
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://twitter.com/FilipNils Filip Nilsson

    Is there any reason NOT to use this? I dont see why this is not by default when you buy a macbook if there isn’t any cons.

    • http://twitter.com/jordanmerrick Jordan Merrick

      As FileVault 2 introduces disk level encryption, the downsides do seem to be lacking! I’ve been using FileVault 2 since I purchased my MacBook Air in June and have had zero issues with it so I can recommend this for everyone!

  • Ovidiu

    That was quite self explaining but I’d need some help since my user home folder is located on a second partition and that seems to remain unencrypted by default. Any help encrypting a second partition without reformatting?

    • http://twitter.com/jordanmerrick Jordan Merrick

      Within Disk Utility, you can encrypt other drives by selecting them and using the File > Turn On Encryption menu. However, I would advise against this in your case.

      When FileVault 2 is turned on, the login window actually becomes the first part of the boot process so your account can unlock the drive and continue logging in. As you’d only be encrypting the drive with your home folder on it and encrypted disks can only be accessed once a user is logged in (hence FileVault 2 moving the login window to the first part of the boot process) you might find yourself permanently locked out!

      • Ovidiu

        It seems so at first but while googling for this problem I found there are ways around it while keeping the structure as I mentioned. The problem is just that some of the tutorials seem to contradict themselves so I didn’t risk testing it.

  • Noobs_R_Us

    Hi, I understand that there are no performance hits while doing this. However, once question I have it how does this encryption work alongside Find my Mac? Once of the main thing about Find my Mac is that you leave some back door open so that if you lose your mac or have it stolen, once the mac is turned on, it can ping Apple’s servers and upload the location. If I have FileVault 2 turned on will it be able to do this? It sounds like by turning on FileVault 2, you essentially defeat Find my Mac if it’s ever lost of stolen as the computer will never log in to run the program and ping the servers?