Skip to main content
4 events
when toggle format what by license comment
May 24, 2021 at 14:53 comment added frostschutz @EvilSupahFly I just used the command given in the question, as there was no real reason to change it. fallocate is fine too, or truncate. when you mkfs, it will trim/free the unused space (at least for ext234 and others, unless you disable it), so don't expect it to be pre-allocated anymore afterwards.
May 24, 2021 at 14:46 comment added EvilSupahFly Rather than dd on newer distros, I would use fallocate -l size /path/to/image.img to pre-allocate space to an image file (where the -l option specifies the length of the allocation, in bytes where the suffixes of k, m, g, t, p, e may be specified to denote KiB, MiB, GiB, etc.). You'll need mkfs to format the filesystem inside the image, but I find that it's still faster and cleaner this way. This is still a good answer, though, so I'm giving it an upvote. :)
Feb 13, 2020 at 16:55 vote accept Fabio
Feb 13, 2020 at 19:12
Feb 13, 2020 at 16:10 history answered frostschutz CC BY-SA 4.0