> why not simply zip them? of course one can also read/write > directly to zipped files. the reason i ask is that we do this > alot. * Availability: A zipped file is not readily available (for QEMU). * Speed: It takes an awful lot of time to zip and unzip (typically 4 GB per file!) * Size: The sparse file is smaller than the zipped file (using gzip). (Although I didn't expect that... ;]) * Code: Better readable code: io = TCPServer.new("0.0.0.0", 4444).accept SparseFile.open("file") do |f| while (not io.closed? and data = io.gets) f.write(data) end end > what would you consider trade-offs to be with SparseFile? * It might me just a little bit slower than writing to ordinary files, because of the extra check and the housekeeping. (But it is much, much faster than using ZIP-files...) * Over time, after thousands or millions of random-access writes to the same file, the holes are gone. ZIP-files might stay small. (But ZIP-files are very, very slow...) Notice this is not a disadvantage compared to ordinary files. gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- $ ls -lh winxp.img -rw-r--r-- 1 erik erik 4.0G 2007-01-05 17:29 winxp.img $ du -h winxp.img 997M winxp.img $ gzip < winxp.img | wc -c 1467534047 # That's more than the sparse file! $ time gzip < winxp.img > /dev/null real 5m55.910s # 5 Minutes! user 4m51.922s sys 0m6.816s ----------------------------------------------------------------