Home > Blog > Resizing TrueCrypt volumes

Resizing TrueCrypt volumes

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: ,
  1. Anonymous
    September 7th, 2008 at 00:41 | #1

    This should work and this seems to be the way to format a truecrypt partition with something else than a fat filesystem.

  2. Tecna
    August 31st, 2009 at 01:41 | #2

    My bet is that is is perfectly secure…  It leaves the volume headers intact, so truecrypt knows to use the same encryption throughout the volume, even after its size is changed.
    I’m usung an adapted version of this method to allow my computer to take breaks while creating volumes, as Truecrypt bogs down my CPU and eats RAM.  Now I can just make a tiny volume and use dd several times to grow it while I’m not in need of the RAM it gobbles up.

  3. Tecna
    August 31st, 2009 at 05:58 | #3

    resize2fs: Device or resource busy while trying to open /dev/loop0  Couldn’t find valid filesystem superblock.

  4. knnniggett
    December 24th, 2009 at 16:47 | #4

    Unless I’m experiencing an episode of user error (happens from time to time), this method no longer appears to work with newer versions of Truecrypt (e.g. 6.3a). 

    After expanding the volume file, resize2fs does not acknowledge that there is any additional room to grow.

  5. zly
    December 25th, 2009 at 23:34 | #5

    You seem to be right, I’ve just tested on 6.3, and it won’t allow it.
    I’ll have to look into it some more, the problem seems to be that the partion no longer resizes along with the container file as before.

    I’ve added a notice to this blog post, that this method does not work for Truecrypt version higher than 6.2.

    March 5th, 2011 at 21:35 | #6

    I’ve read several good stuff here. Certainly worth bookmarking for revisiting. I wonder how much effort you put to make such a fantastic informative website.
    Nauka Jazdy