Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

Should I Defrag TrueCrypt?

Question: Should I defrag a TrueCrypt volume and if so, should I do it with the volume open or closed? 

You know, that’s one that I haven’t thought of before. But now that you bring it up, I intend to act on it.

I believe the answer is yes. You should defrag and yes, do it with the volume open, but with one caveat.

Become a Patron of Ask Leo! and go ad-free!

Avoid the SSD

The caveat is that you should not defragment a solid state drive.

So if your TrueCrypt volume is stored on an SSD, don’t defrag it. Defragmenting is done to prevent performance issues and Solid State Drives don’t really benefit from it very much, if at all. And there’s also some controversy as to whether defragmenting an SSD can actually shorten its life. I just recommend avoiding that issue entirely and only deal with defragmenting on regular spinning platter magnetic media hard drives.

Now, a TrueCrypt volume is a single file. When mounted, you can place files into that file that are automatically encrypted and decrypted.

So, you have a file, and within that file, you have other files.

It might be worth defragmenting both.

Fragmentation MapDefrag the container, once

First, with the volume dismounted, defragment the drive that contains the volume.

So, for example, if you have your TrueCrypt volume on C:, defrag C:.

The good news here is that you really only need to do this once. Because the container never moves (meaning that you don’t copy it around and you don’t grow it or shrink it – it just sits there being a container), it won’t get fragmented.

Defrag the contents occasionally

When the volume is mounted in TrueCrypt, it appears as another drive, and its contents are treated as another disk drive. That means that the files on this other disk drive could indeed get fragmented.

So, next, with the volume mounted, defrag the volume. What that means is if you mount your TrueCrypt volume as drive F:, then you would defrag drive F:.

As it turns out, Windows might not let you.

I looked with the Windows defragger, and it told me that defragger was unavailable for my mounted volume. On a whim, I fired up Piriform’s Defraggler, and it works – it’s defragging my TrueCrypt volume right now.

If you don’t do a lot of work within the drive, it’s probably not worth defragging very often. On the other hand, if files within the True Crypt are frequently being created, deleted, and written and so on, then yes, a periodic defrag might very well be a good thing.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

6 comments on “Should I Defrag TrueCrypt?”

  1. I’m not sure what these TrueCrypt drives you’re referring to are, but from read I’ve read here, exactly the same things can be said about the virtual machine drives (VirtualBox’s .vdis, Virtual PCs .vhds, etc.), which also happen to be drives within files. It has been said that guest OSes need to defragment their drives in addition to real computers. In fact, one time, either my host’s Windows partition did not show up in defragmenter or it gave me error when defragmenting it, but whatever the problem, defragmenting the guest fixed it.

    Reply
  2. I think we should not defragment container with hidden volume.
    I have no problem to defragment mounted Truecrypt volume with Windows 7, the only thing I do not understand is : after I defragged a mounted TC drive, the next time (even next day) if I defrag that very drive in same mounted drive letter, it still shows : “never run”…is this a function of TC ?

    Reply
  3. > I looked with the Windows defragger, and it told me that defragger was unavailable for my mounted volume

    Yes, that has been my experience as well.

    I’ve been playing around with using VeraCrypt file containers on Windows 8.1 (sadly, not Windows 8.1 Pro or I could use BitLocker), and no matter what I do, I can’t use the built-in Windows tools for checking and defragging mounted VeraCrypt volumes.

    So given that, thanks for suggesting this:

    > On a whim, I fired up Piriform’s Defraggler, and it works – it’s defragging my TrueCrypt volume right now.

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.