NetBSD/usr.bin/vndcompress/vndcompress.1

207 lines
5.8 KiB
Groff

.\" $NetBSD: vndcompress.1,v 1.3 2005/12/12 21:04:31 hubertf Exp $
.\"
.\" Copyright (c) 2005 Florian Stoehr <netbsd@wolfnode.de>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Florian Stoehr
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd December 12, 2005
.Dt VNDCOMPRESS 1
.Os
.Sh NAME
.Nm vndcompress ,
.Nm vnduncompress
.Nd compress/uncompress file system images to/from cloop2 format
.Sh SYNOPSIS
.Nm
.Op Fl cd
.Ar disk/fs-image
.Ar compressed-image
.Op Ar blocksize
.Nm vnduncompress
.Op Fl cd
.Ar compressed-image
.Ar disk/fs-image
.Sh DESCRIPTION
The
.Nm
program compresses an existing file system image
into a cloop2 compatible compressed file system image.
An optional blocksize can be given.
If omitted, the default of 64kB is used.
.Pp
The
.Nm vnduncompress
command decompress a cloop2-compressed file system image back into a
regular image.
.Pp
The
file system images that can be handled are not limited to any specific
file system, i.e. it is possible to handle images e.g. in ISO 9660 or
UFS/FFS format.
File system images in the cloop2 format are intended to be used with the
.Xr vnd 4
driver in compressed mode as configured by the
.Fl z
option of the
.Xr vnconfig 8
program, and later mounted with the appropriate
.Fl t
option to
.Xr mount 8 .
.Sh OPTIONS
The following options are available:
.Bl -tag -width indent
.It Fl c
Always compress, even if the programm was started as
.Nm vnduncompress .
.It Fl d
Always uncompress (decompress), even if the program was started as
.Nm .
.El
.Sh EXIT STATUS
The
.Nm
and
.Nm vnuncompress
utilities exit with one of the following values:
.Bl -tag -width 4n
.It 0
The operation was performed successfully.
.It 1
An error occurred.
.El
.Sh EXAMPLES
To compress an existing CD-ROM file system image, run the following
commands:
.Bd -literal -offset indent
# vndcompress netbsd.iso netbsd.izo
.Ed
.Pp
Note that the resulting compressed image cannot be mounted directly
via
.Nx Ap s
.Xr vnd 4
and
.Xr mount_cd9660 8
commands any longer.
Instead, you will have to use the
.Fl z
option of
.Xr vnconfig 8 .
.Pp
The following example decompresses an existing CD-ROM file system
image that was compressed in the cloop2 format into a regular
file that can then be mounted:
.Bd -literal -offset indent
# vnconfig vnd0 KNOPPIX.iso
# mount -t cd9660 -o ro /dev/vnd0d /mnt
# vnduncompress /mnt/KNOPPIX/KNOPPIX /var/tmp/knoppix.iso
# umount /mnt
# vnconfig -u vnd0
#
# vnconfig vnd1 /var/tmp/knoppix.iso
# mount -t cd9660 -o ro /dev/vnd1d /mnt
# ls /mnt
\&.rr_moved cdrom floppy lib opt sbin usr
bin dev home mnt proc sys var
boot etc initrd none root tmp vmlinuz
# umount /mnt
# vnconfig -u vnd1
.Ed
.Pp
As an alternative, if your
.Xr vnd 4
was compiled with
.Dv VND_COMPRESSION ,
you can use
.Xr vnconfig 8
to access the cloop-compressed image directly, e.g.,
.Bd -literal -offset indent
# vnconfig vnd0 KNOPPIX.iso
# mount -t cd9660 -o ro /dev/vnd0d /mnt
# vnconfig -z vnd1 /mnt/KNOPPIX/KNOPPIX
# mount -t cd9660 -o ro /dev/vnd1d /mnt2
# ls /mnt2
\&.rr_moved cdrom floppy lib opt sbin usr
bin dev home mnt proc sys var
boot etc initrd none root tmp vmlinuz
# df /mnt /mnt2
Filesystem Size Used Avail Capacity Mounted on
/dev/vnd0a 692M 692M 0B 100% /mnt
/dev/vnd1a 1.9G 1.9G 0B 100% /mnt2
# umount /mnt2
# vnconfig -u vnd1
# umount /mnt
# vnconfig -u vnd0
.Ed
.Pp
Note how the 1.9GB big filesystem on
.Pa /mnt2
is mounted from the compressed file stored on the 692MB CD mounted
on
.Pa /mnt .
To create a compressed file system image of an existing
directory and mount it, run:
.Bd -literal -offset indent
# makefs -t ffs include.fs /usr/include
# vndcompress include.fs include.fs.cloop2
# vnconfig -z vnd0 include.fs.cloop2
# mount -o ro /dev/vnd0a /mnt
# ls /mnt
.Ed
.Pp
To undo the steps, run:
.Bd -literal -offset indent
# umount /mnt
# vnconfig -u vnd0
# rm /tmp/include.img.cloop2
# rm /tmp/include.img
.Ed
.Sh SEE ALSO
.Xr gzip 1 ,
.Xr vnd 4 ,
.Xr mount 8 ,
.Xr mount_cd9660 8 ,
.Xr vnconfig 8
.Sh AUTHORS
.An -nosplit
The
.Nm
utility was written by
.An Florian Stoehr
.Aq netbsd@wolfnode.de .
The
.Nm
manual page was written by
.An Florian Stoehr
.Aq netbsd@wolfnode.de
and
.An Hubert Feyrer
.Aq hubertf@NetBSD.org .