I have an application that creates many directories. Also as part of the app, I have a loop device on an encrypted luks file system (yes I rebuilt the kernel to have loop device)
- On the loop file system (encrypted) , I created a 1TB file, filled with random data, and did a simple format after luksOpening it. mkfs.ext4 /dev/loop0
Every directory on this takes 4096 bytes extra (4KB).
- On /DataVolume, if I create a directory it takes 65536Bytes, this is 64KB. I noticed the difference after my encrypted drive was fine but my unencrypted directory (under /DataVolume) got full pretty quick.
My question is, is this a datablock size issue? /DataVolume is also formatted as mkfs.ext4, why does each directory hold up 64KB??? The many directories in my application causes the disk space to fill up really quick.
1) Can I create a directory which has 4KB metadata instead of 64KB metadata on /DataVolume?
2) What is the best solution for me? Do I create a 1TB file, format it mkfs.ext4 and attaach it via loop device to get a 4096KB directory structure filesystem?