4 ms·
truncate -s 100T hugefile.img Another way to do this.
by jagger27 6y ago
truncate -s 100T hugefile.img
Another way to do this.
- segfaultbuserr 6y agoLinux also has another one. fallocate --length 1TB.img "truncate" is in GNU coreutils, "fallocate" is in util-linux.
- cmurf 6y agoThey are not the same thing. Check them with 'ls -lsh' and you'll see the sparse file from truncate uses no sectors. Whereas the fallocated file is fully preallocated. If you have 100G free, truncate -S 1T will succeed, fallocate -l 1T will not.
- segfaultbuserr 6y agoAh, yes. I stand corrected. I've mixed up the concept of preallocating an uninitialized file and a true sparse file.