sparse files

Roger Oberholtzer roger
Thu May 26 11:05:06 PDT 2005


(I deleted Matt's question about why I don't just gzip things. Here is
a reply.)

When I make a sparse image for use with qemu, say 6GB, very little is
actually allocated from my hard disk. It only really takes space when I
really put something in the file. With qemu, I use this file as a 'disk
image' into which an operating system can be installed. As such, it must
have some concept of size (in my case 6GB). Effectively, I am telling
qemu that there is a partition that is 6GB. In this image, the operating
system can do whatever it likes, just as it would with a partition. But
the space taken on my hard disk is only what the installed operating
system actually puts there. Not the full 6GB.

Of course, I could tell qemu to use a file where storage from the hard
disk has in fact been taken. Then gzip or is an option for transporting
these images.

If I install w98 into a 6 GB sparse file, it will only really take 300M
or so. So, I could back up the 6 GB image to a CD. It the file is really
6GB, it will take more. OK, I would initialize the space to 0, so if it
is not used the compression may be quite good.

What I am wondering (another experiment) is if I remove content from a
sparse file, does the space allocated for it decrease as well?

Disk space is cheap these days. But sparse files seem less wasteful.


+????????????????????????????+???????????????????????????????+
? Roger Oberholtzer          ?   E-mail: roger at opq.se        ?
? OPQ Systems AB             ?      WWW: http://www.opq.se/  ?
? Kapellgr?nd 7              ?                               ?
? P. O. Box 4205             ?    Phone: Int + 46 8   314223 ?
? 102 65 Stockholm           ?   Mobile: Int + 46 733 621657 ?
? Sweden                     ?      Fax: Int + 46 8   314223 ?
+????????????????????????????+???????????????????????????????+



More information about the Linux-users mailing list