Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also fallocate (Linux only though).


dd can do it on an existing file or stream, transforming sequences of 0 it contains into "holes".


caveat operator: to ensure the conv=sparse operand achieves the desired outcome, be sure to use an output blocksize equal to st_blksize of the output filesystem.


or just use `cp --sparse=always` if it's from one file to another


That is not so portable, so I recommend sticking with dd.


Yup, `dd` helps in a lot of situations when you need portability, not just this one.

Commands like `cp --sparse=always` aren't worth such a blanket disrecommendation though; if you are working directly at a console as opposed to scripting you typically don't need portability.


Again, most of the consoles I work at don’t use GNU coretools.


Then you obviously can't use this, but many people reading my suggestion can.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: