On Fri, 5 Oct 2007, Moinak Ghosh wrote: > Alok Aggarwal wrote: >> [...] Examples: >> >> - 1. Compress a file with gzip >> + 1. Compress a file with gzip and add the compressed file as a block >> + device >> >> - # lofiadm -C gzip /export/home/solaris.iso >> + # lofiadm -a -C gzip /export/home/solaris.iso >> >> - 2. Compress a file with gzip and compress it in 64k chunks >> + 2. Compress a file with gzip in 64k chunks and add the compressed >> + file as a block device >> >> # lofiadm -C gzip -s 64k /export/home/solaris.iso >> > > Shouldn't this be: > > lofiadm -a -C gzip -s 64k /export/home/solaris.iso > ?
It should be, it's a typo. > On the other hand, what will be the name of the compressed file ? > Would it remain as the original filename ? Can cause confusion. The name of the file remains the same. Why will it cause confusion? If you start adding extensions such as .gz to the compressed file, what's stopping a user from running gunzip(1) or your favorite decompression utility on that file and getting disappointed to see it fail. The key is that a file compressed with lofiadm is useful only within the context of lofi(7D) and not outside it. Not adding an extension just reinforces that point. > What happens to the compressed file when it is unmapped ? If it wasn't explicitly uncompressed by the user it stays compressed. > The process of compression is a very time consuming task, probably > on the order of 30 - 50mins for 2GB worth of data, because it is > chunked compression (though this can be improved by some > parallelization and buffering techniques). So IMHO it is less > confusing to do something like this: > > lofiadm -C gzip -s 64k /export/home/solaris.iso > Produces solaris.iso.<ext> compressed file. > > lofiadm -a /export/home/solaris.iso.<ext> > Maps the compressed file. > > lofiadm Outputs: > > Block Device File Options > /dev/lofi/1 /export/home/solaris.iso.<ext> Compressed (gzip) > /dev/lofi/2 /export/home/regular.iso.<ext> - > > > Semantically similar to using gzip or any other compression utility > for that matter. The original proposal had what you're suggesting, i.e. "compress this file with -C" and "map this compressed file with -a" as a two step process. As part of some offline discussions it was suggested that having these two actions as disjoint steps doesn't buy us anything. If a user compresses a file with lofiadm, in all certainity he's bound to map that compressed file as a logical next step so why not just enable him to do that in a single command invocation. Apropos making compression a separate step so the user doesn't wonder if the command is hung, the lofiadm output will change to printing something like this to stderr (so scripts don't break) - # lofiadm -a -C gzip -s 64k /export/home/solaris.iso Compressing solaris.iso Mapping solaris.iso /dev/lofi/1 I had meant to add this to the updated spec but apparently missed it. Alok
