veracrypt / VeraCrypt

Disk encryption with strong security based on TrueCrypt
https://www.veracrypt.fr
Other
6.89k stars 947 forks source link

Uunable to create container-file larger 2 TB on a 4k sectored disk #262

Open ghost opened 6 years ago

ghost commented 6 years ago

hello everyone,

I'm very frustrated about a problem with Veracrypt (1.21) under Linux (every). No matter what I do with the 4k (with emulated 512) hdds, it seems impossible to create a container-file (hidden-volume) larger then 2 TB. I get the error-message that say the drive is not a 4k sector-ed, but fdisk output say it is:

Disk /dev/sdb: 2,7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: *****

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048 5860532223 5860530176  2,7T Linux filesystem

I tried several time to format new filesystem (ext4) and gpt-table. Always same result. Strange is also I dont have a choice for the outer volume filesystem, it just try to format. Tests with other drives/volume/size combination success-ed but I cant choose outer-volume filesystem either.

On Windows all worked fine before with the disks and veracrypt, same combination. I just wanted to change all NTFS drives (4x 3 TB) now into ext4.

Another interesting thing is, fdisk/gdisk shows me that the other drives haven't a correct alignment, but windows says they do. I never had any problems yet. Even performance is good as well.

Whats is wrong in linux? Please help, what I can do?

wtechgo commented 2 months ago

I also ran into this issue.
Note, creating hidden storage on a Windows spy device kinda beats the purpose.

wtechgo commented 2 months ago

It seems I figured out the issue, here are my notes.


Error: The hidden volume to be created is larger than 2 TB (2048 GB).

Issue: The hard disk configuration has a logical sector size that is too low for VeraCrypt. Most likely, the logical sector size is 512 bytes. Check your values with sudo fdisk -l or in a partition manager.

Even though the physical sector size of your disk might be a suitable 4096 bytes, VeraCrypt will look at the logical sector size of 512 bytes, and throw the error.

Solution: Contrary to the physical sector size, which can't be changed, the logical sector size can be changed, reconfigured.

Increase the logical sector size from 512 bytes to 4096 bytes.
WARNING: All data on the disk will be lost.

hdparm --set-sector-size 4096 --please-destroy-my-drive /dev/sdX
reboot

# Credits: https://unix.stackexchange.com/a/669274/261309

In VeraCrypt, when you create the Hidden Volume, be sure to chose Files larger than 4 GB. This step in the wizard is a clear indicator stuff is working.