I am building a system that gives users certain amounts of disk space. The way I am doing it is:
- create a file with dd
- create an ext4 filesystem inside the file
- mount the file and tell the user program to use the mountpoint as its working directory
I do not want to use the linux quota system as I dont want the users to be local system users.
The above works fine, but it wastes space as the users are not using all of their allowance but the entire allowance has been allocated already.
Is there a command that can do the same thing as dd but not allocate the whole file at once? So I could make a 20gb file, and when its mounted it would report 20gb of space, but it would only physically take up what has been written to it?