VeraCrypt icon indicating copy to clipboard operation
VeraCrypt copied to clipboard

Not enough space error at 98.001% when creating a file container with "use all available free space"

Open 1ncend1ary opened this issue 2 years ago • 2 comments

Please see Steps to reproduce.

Expected behavior

Volume Creation Wizard exits normally.

Observed behavior

Please see Steps to reproduce.

Steps to reproduce

  1. Attach external drive, format it as APFS (encrypted), 465 GiB
  2. Open VeraCrypt volume creation wizard
  • Encrypted file container,
  • standard volume,
  • use all available free space,
  • large files: yes,
  • exFAT,
  • I will mount this volume on other partitions
  1. Press "Format"
  2. Wait
  3. At 98.001% VeraCrypt throws out error "not enough space"

Screenshots

Your Environment

Please tell us more about your environment

VeraCrypt version: 1.25.9, dmg install

Operating system and version: Mac OSX 10.15.7

System type: 64-bit

1ncend1ary avatar Jun 01 '22 08:06 1ncend1ary

I've been looking into this for a while now, and fail to find any elegant solutions. The issue is that you actually can't use all the free space reported by the system, as the filesystem has overhead to actually write metadata, master file table, inodes, whatever the filesystem uses under the hood.

There's also very little information around, or at least from what I could find, how you would begin approximating the slack you need for the file to actually fit. You could do something rudimentary such as just capping the largest container possible to ~99% of the available space and in most cases that would be enough to never fail the file container creation process.

Jertzukka avatar Dec 27 '23 09:12 Jertzukka

@Jertzukka

The issue is that you actually can't use all the free space reported by the system, as the filesystem has overhead to actually write metadata, master file table, inodes, whatever the filesystem uses under the hood.

This actually happens with the plain NTFS file system or any other file system with writes before reads. Try to create the big one file and another one to fill drive empty space up to 0. Then try to move first file to another drive. It won't let you do this, because will try to write to drive before a copy operation (movement between drives is a copy).

I've been looking into this for a while now, and fail to find any elegant solutions.

Solution is might be simple. Write an empty dummy file of %1 of a free space and >= 100MB to the drive near the container file. Then start to write the container file. When the space is reached 0, then try to join 2 files in that sequence: truncate in the middle the dummy file and then continue write into the container. Keep continue until the dummy file is 0 truncated.

andry81 avatar Dec 27 '23 16:12 andry81