4 ms·
No, mkfile creates a file with written extents (no sparse or uninitialized areas), while fallocate will (with ext4/xfs/...) only map some extents which are mark
by throwawayish 10y ago
No, mkfile creates a file with written extents (no sparse or uninitialized areas), while fallocate will (with ext4/xfs/...) only map some extents which are marked uninitialized. So while mkfile 10G would have to write ~10 GB of data, fallocate 10G is nearly instanteneous, because it most likely just allocated a single extent.
xfs_mkfile could do what mkfile does, the description isn't conclusive enough.
- gcr 10y agoYou can use good old `dd` for this: dd if=/dev/zero of=test bs=1k seek=2m count=1 Or python: python -c 'f=open("test", "w"); f.seek(2e9); f.write("\x00")' Both these calls create a ~2GB file with holes in it. They return almost instantly on OSX. EDIT: oh wait, this isn't what you want. you want a file _without_ holes, my mistake.
- masklinn 10y agoYeah without hole would be dd if=/dev/zero of=test bs=1k count=2m
- justincormack 10y agoOSX doesn't support sparse files...
- parasubvert 10y agoIt does, just not at the HFS+ layer. Sparse bundles are the functional equivalent at the Vitual file system layer and are used by Time Machine and are useable by developers or via the CLI. Sparse images are entire virtual volumes and are used for FileVault. https://en.m.wikipedia.org/wiki/Sparse_image https://en.m.wikipedia.org/wiki/Sparse_image
- id_kc 10y ago>just not at the HFS+ layer macOS supports sparse bundle with HFS+
- parasubvert 10y agoAs I was saying, that's implemented above HFS+
- Wevah 10y agoTo clarify: FileVault on 10.6 and earlier; current FileVault is FDE.