xref: /netbsd-src/usr.bin/vndcompress/vndcompress.1 (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1.\"	$NetBSD: vndcompress.1,v 1.6 2007/03/24 23:16:11 dillo Exp $
2.\"
3.\" Copyright (c) 2005 Florian Stoehr <netbsd@wolfnode.de>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"        This product includes software developed by Florian Stoehr
17.\" 4. The name of the author may not be used to endorse or promote products
18.\"    derived from this software without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"
33.Dd December 12, 2005
34.Dt VNDCOMPRESS 1
35.Os
36.Sh NAME
37.Nm vndcompress ,
38.Nm vnduncompress
39.Nd compress/uncompress file system images to/from cloop2 format
40.Sh SYNOPSIS
41.Nm
42.Op Fl cd
43.Ar disk/fs-image
44.Ar compressed-image
45.Op Ar blocksize
46.Nm vnduncompress
47.Op Fl cd
48.Ar compressed-image
49.Ar disk/fs-image
50.Sh DESCRIPTION
51The
52.Nm
53program compresses an existing file system image
54into a cloop2 compatible compressed file system image.
55An optional blocksize can be given.
56If omitted, the default of 64kB is used.
57.Pp
58The
59.Nm vnduncompress
60command decompress a cloop2-compressed file system image back into a
61regular image.
62.Pp
63The
64file system images that can be handled are not limited to any specific
65file system, i.e. it is possible to handle images e.g. in ISO 9660 or
66UFS/FFS format.
67File system images in the cloop2 format are intended to be used with the
68.Xr vnd 4
69driver in compressed mode as configured by the
70.Fl z
71option of the
72.Xr vnconfig 8
73program, and later mounted with the appropriate
74.Fl t
75option to
76.Xr mount 8 .
77.Sh OPTIONS
78The following options are available:
79.Bl -tag -width indent
80.It Fl c
81Always compress, even if the program was started as
82.Nm vnduncompress .
83.It Fl d
84Always uncompress (decompress), even if the program was started as
85.Nm .
86.El
87.Sh EXIT STATUS
88The
89.Nm
90and
91.Nm vnduncompress
92utilities exit with one of the following values:
93.Bl -tag -width 4n
94.It 0
95The operation was performed successfully.
96.It 1
97An error occurred.
98.El
99.Sh EXAMPLES
100To compress an existing CD-ROM file system image, run the following
101commands:
102.Bd -literal -offset indent
103# vndcompress netbsd.iso netbsd.izo
104.Ed
105.Pp
106Note that the resulting compressed image cannot be mounted directly
107via
108.Nx Ap s
109.Xr vnd 4
110and
111.Xr mount_cd9660 8
112commands any longer.
113Instead, you will have to use the
114.Fl z
115option of
116.Xr vnconfig 8 .
117.Pp
118The following example decompresses an existing CD-ROM file system
119image that was compressed in the cloop2 format into a regular
120file that can then be mounted:
121.Bd -literal -offset indent
122# vnconfig vnd0 KNOPPIX.iso
123# mount -t cd9660 -o ro /dev/vnd0d /mnt
124# vnduncompress /mnt/KNOPPIX/KNOPPIX /var/tmp/knoppix.iso
125# umount /mnt
126# vnconfig -u vnd0
127#
128# vnconfig vnd1 /var/tmp/knoppix.iso
129# mount -t cd9660 -o ro /dev/vnd1d /mnt
130# ls /mnt
131\&.rr_moved cdrom     floppy    lib       opt       sbin      usr
132bin       dev       home      mnt       proc      sys       var
133boot      etc       initrd    none      root      tmp       vmlinuz
134# umount /mnt
135# vnconfig -u vnd1
136.Ed
137.Pp
138As an alternative, if your
139.Xr vnd 4
140was compiled with
141.Dv VND_COMPRESSION ,
142you can use
143.Xr vnconfig 8
144to access the cloop-compressed image directly, e.g.,
145.Bd -literal -offset indent
146# vnconfig vnd0 KNOPPIX.iso
147# mount -t cd9660 -o ro /dev/vnd0d /mnt
148# vnconfig -z vnd1 /mnt/KNOPPIX/KNOPPIX
149# mount -t cd9660 -o ro /dev/vnd1d /mnt2
150# ls /mnt2
151\&.rr_moved cdrom     floppy    lib       opt       sbin      usr
152bin       dev       home      mnt       proc      sys       var
153boot      etc       initrd    none      root      tmp       vmlinuz
154# df /mnt /mnt2
155Filesystem    Size      Used     Avail Capacity  Mounted on
156/dev/vnd0a    692M     692M        0B   100%    /mnt
157/dev/vnd1a    1.9G     1.9G        0B   100%    /mnt2
158# umount /mnt2
159# vnconfig -u vnd1
160# umount /mnt
161# vnconfig -u vnd0
162.Ed
163.Pp
164Note how the 1.9GB big filesystem on
165.Pa /mnt2
166is mounted from the compressed file stored on the 692MB CD mounted
167on
168.Pa /mnt .
169To create a compressed file system image of an existing
170directory and mount it, run:
171.Bd -literal -offset indent
172# makefs -t ffs include.fs /usr/include
173# vndcompress include.fs include.fs.cloop2
174# vnconfig -z vnd0 include.fs.cloop2
175# mount -o ro /dev/vnd0a /mnt
176# ls /mnt
177.Ed
178.Pp
179To undo the steps, run:
180.Bd -literal -offset indent
181# umount /mnt
182# vnconfig -u vnd0
183# rm /tmp/include.fs.cloop2
184# rm /tmp/include.fs
185.Ed
186.Sh SEE ALSO
187.Xr gzip 1 ,
188.Xr vnd 4 ,
189.Xr mount 8 ,
190.Xr mount_cd9660 8 ,
191.Xr vnconfig 8
192.Sh AUTHORS
193.An -nosplit
194The
195.Nm
196utility was written by
197.An Florian Stoehr
198.Aq netbsd@wolfnode.de .
199The
200.Nm
201manual page was written by
202.An Florian Stoehr
203.Aq netbsd@wolfnode.de
204and
205.An Hubert Feyrer
206.Aq hubertf@NetBSD.org .
207