3 ms·
Dd is the only tool I know to make sparse disk images. Eg: Dd if=/dev/zero of=image.img bs=1k count=1 seek=999999 Will give you a 1gb file of zeros that take
by ay 4y ago
Dd is the only tool I know to make sparse disk images.
Eg:
Dd if=/dev/zero of=image.img bs=1k count=1 seek=999999
Will give you a 1gb file of zeros that takes up 1kb of disk space until you start to write to it, at which point it will transparently “expand on write”.
- bombolo 4y agoBut you could use truncate to create the file.
- hiq 4y agoThere's probably a way to do that with fallocate, I see it has a -d option to make "the file sparse in-place, without using extra disk space".
- deleted 4y ago[deleted]
- donio 4y agotruncate -s 1g image.img Or fallocate if you want it to complete instantly without disk writes but still allocate the space.