[colug-432] creating sparse disk images

Rick Hornsby richardjhornsby at gmail.com
Tue Nov 13 13:25:54 EST 2018


argh. sorry. Hit the wrong key combo before I was finished.

On November 13, 2018 at 11:13:31, Matthew Hyclak (hyclak at gmail.com) wrote:

Been a while since I did this, but I believe you have to make sure the
filesystem you want to be sparse actually contains 0's in the places you'd
like to be sparse before creating the sparse file.

https://unix.stackexchange.com/questions/44234/clear-unused-space-with-zeros-ext3-ext4
 looks like a good starting point.


Thanks. I had seen that thread. I used zerofree, but it didn’t seem to
matter. Because of your link though, I read farther down the page to some
information about cp with the ‘—sparse=always’ flag, and some hints about
reported size between ls and du.
Interestingly enough, I messed around and got the following:

cp —sparse=always 16GB_file sparse_file -> 3.7GB, as per du. ls still says
it’s 16GB.

Right. So 16GB file drops to 3.7GB, says du.

I then copied (cp) that 3.7GB file back to my Mac without really thinking
too much and without any flags, and it ballooned into an 8GB file. No idea
why.

I tried the same copy of the 3.7GB file again (Linux VM -> Mac with cp)
adding the —sparse=always flag this time, and it landed as a 4GB file. I
think maybe I’m on the right track, or at least getting there. Maybe.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20181113/74054f54/attachment.html 


More information about the colug-432 mailing list