Home > Blog > Resizing TrueCrypt volumes

Resizing TrueCrypt volumes

April 26th, 2008

Development of TrueCrypt was discontinued in 2014. Using TrueCrypt is not secure as it may contain unfixed security issues.
Find an alternative at: http://alternativeto.net/software/truecrypt/

Note: This approach does not seem to work with Truecrypt versions > 6.2

Can it be done ?

Not according to TrueCrypt‘s FAQ.
A quick search through their forums, does not reveal optimistic results either.

Nevertheless, I believe I managed to resize (only grow, not shrink) fixed-size TrueCrypt volumes (container files) formated with ext3 in the past. And I just tested it out again today, and it seems to be working pretty well. I have resized multiple volumes, without loosing any data. What impact, if any, it might have on the security of the volume, is beyond my knowledge of disk encryption.

So, if you try the following, I will not be held responsible for data-loss, weakened security of the volume, or anything of that kind. That being said, it works very well for me.
The following is what I did to resize a fixed-size TrueCrypt volume:

1. Create a fixed-size TrueCrypt volume (container file, not entire disk/partition), without a filesystem format.
Mount it in slot 1, without filesystem mount, through the TrueCrypt GUI.
Run mkfs.ext3 /tmp/.truecrypt_aux_mnt1/volume

2. Remount in slot 1, with filesystem mount, through the TrueCrypt GUI.
Copy some files to the volume, just to see if everything is good.
Unmount the TrueCrypt volume.

3. Use the ‘dd’ utility to extend/grow the volume as much as you like, in this example, 100MB:
Run dd if=/dev/urandom bs=1M count=100 >> /path/to/truecrypt_volume.file

4. Mount in slot 1, with filesystem mount, through the TrueCrypt GUI.
Run resize2fs /dev/loop0 (replace loop0 with the loopback device where /tmp/.truecrypt_aux_mnt1/volume is mounted)

5. Run df -h and check that the filesystem has grown. Test that you can still read the files you copied to the volume earlier, and that you can write new files, beyond the limit of the original size of the volume.

That’s it 🙂
It works for me, it might not work for you. No guarantees given.

Tags: ,