VNDCOMPRESS(1) | General Commands Manual | VNDCOMPRESS(1) |
vndcompress | [-c] [-rR] [-b blocksize] [-k checkpoint-blocks] [-l length] [-p partial-offset] [-w winsize] image compressed-image [blocksize] |
vnduncompress | [-d] [-w winsize] compressed-image image |
By default, vndcompress compresses an image, and vnduncompress uncompresses an image, but the -c and -d options can control whether either utility compresses or decompresses.
The following options are available for the compression operation:
For compatibility with the old version of vndcompress, the compression block size may instead be specified at the end of the command line.
The following option is available for both compression and decompression:
A nonzero winsize requires the compressed image to be a seekable file, which compression requires anyway, in order to record the offsets of compressed blocks once they are compressed and written, but which is a limitation for decompression. Thus, decompressing from a pipe is incompatible with a nonzero winsize.
By default, vndcompress uses a fixed window size, unless decompressing with nonseekable input.
# vndcompress cdrom.iso cdrom.izo
Send a 59 GB disk partition over a local network with netcat (don't do this over the internet!):
# nc 10.0.1.2 12345 < /dev/rcgd1h
Receive it and save it compressed on another host, showing a progress bar interactively, restarting if possible, and taking a checkpoint every 16 MB (i.e., every 256 compression blocks, which are 64 KB by default):
# nc -l 12345 | progress -l 59g \ vndcompress -l 59g -k 256 -r /dev/stdin disk.cloop2
If the process is interrupted and you rewire your network and disks so that the receiving host now has the disk you want to image, you can start up where you left off, using the -R option to keep vndcompress from clobbering the partial transfer if anything goes wrong:
# vndcompress -l 59g -k 256 -rR /dev/rcgd1h disk.cloop2
Mount the disk with vnd(4), assuming your kernel was built with the VND_COMPRESSION option enabled:
# vnconfig -z vnd0 disk.cloop2 # mount /dev/vnd0d /mnt
struct cloop2_header { char cl2h_magic[128]; uint32_t cl2h_blocksize; uint32_t cl2h_n_blocks; } __packed;
The cl2h_magic field is an arbitrary sequence of 128 bits, the cl2h_blocksize field is a big-endian integer number of bytes per compression block, and the cl2h_n_blocks field is a big-endian integer number of the compression blocks in the image.
The offset table is a sequence of one more than cl2h_n_blocks big-endian 64-bit integers specifying the offset of each compression block relative to the start of the file. The extra offset specifies the end of the last compression block, which may be truncated if the uncompressed image's size is not a multiple of the compression block size.
January 21, 2014 | NetBSD 6.99 |