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.
Defrag 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.
6 comments on “Should I Defrag TrueCrypt?”
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.
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 ?
My experience is that defragmenters do not keep track of removable drives.
It varies. As I mentioned in the article Windows own defragger didn’t display the TrueCrypt volume, but Defraggler did.
> 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.
The topic is addressed by Veracrypt here: