xref: /netbsd-src/usr.sbin/makefs/makefs.8 (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1.\"	$NetBSD: makefs.8,v 1.37 2011/10/09 21:33:43 christos Exp $
2.\"
3.\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
4.\" All rights reserved.
5.\"
6.\" Written by Luke Mewburn for Wasabi Systems, Inc.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software
17.\"    must display the following acknowledgement:
18.\"      This product includes software developed for the NetBSD Project by
19.\"      Wasabi Systems, Inc.
20.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
21.\"    or promote products derived from this software without specific prior
22.\"    written permission.
23.\"
24.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
28.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34.\" POSSIBILITY OF SUCH DAMAGE.
35.\"
36.Dd October 9, 2011
37.Dt MAKEFS 8
38.Os
39.Sh NAME
40.Nm makefs
41.Nd create a file system image from a directory tree
42.Sh SYNOPSIS
43.Nm
44.Op Fl x
45.Op Fl B Ar endian
46.Op Fl b Ar free-blocks
47.Op Fl d Ar debug-mask
48.Op Fl F Ar mtree-specfile
49.Op Fl f Ar free-files
50.Op Fl M Ar minimum-size
51.Op Fl m Ar maximum-size
52.Op Fl N Ar userdb-dir
53.Op Fl o Ar fs-options
54.Op Fl S Ar sector-size
55.Op Fl s Ar image-size
56.Op Fl t Ar fs-type
57.Ar image-file
58.Ar directory
59.Sh DESCRIPTION
60The utility
61.Nm
62creates a file system image into
63.Ar image-file
64from the directory tree
65.Ar directory .
66No special devices or privileges are required to perform this task.
67.Pp
68The options are as follows:
69.Bl -tag -width flag
70.It Fl B Ar endian
71Set the byte order of the image to
72.Ar endian .
73Valid byte orders are
74.Ql 4321 ,
75.Ql big ,
76or
77.Ql be
78for big endian, and
79.Ql 1234 ,
80.Ql little ,
81or
82.Ql le
83for little endian.
84Some file systems may have a fixed byte order; in those cases this
85argument will be ignored.
86.It Fl b Ar free-blocks
87Ensure that a minimum of
88.Ar free-blocks
89free blocks exist in the image.
90An optional
91.Ql %
92suffix may be provided to indicate that
93.Ar free-blocks
94indicates a percentage of the calculated image size.
95.It Fl d Ar debug-mask
96Enable various levels of debugging, depending upon which bits are
97set in
98.Ar debug-mask .
99XXX: document these
100.It Fl F Ar mtree-specfile
101Use
102.Ar mtree-specfile
103as an
104.Xr mtree 8
105.Sq specfile
106specification.
107.Pp
108If a specfile entry exists in the underlying file system, its
109permissions and modification time will be used unless specifically
110overridden by the specfile.
111An error will be raised if the type of entry in the specfile
112conflicts with that of an existing entry.
113.Pp
114In the opposite case (where a specfile entry does not have an entry
115in the underlying file system) the following occurs:
116If the specfile entry is marked
117.Sy optional ,
118the specfile entry is ignored.
119Otherwise, the entry will be created in the image, and it is
120necessary to specify at least the following parameters in the
121specfile:
122.Sy type ,
123.Sy mode ,
124.Sy gname ,
125or
126.Sy gid ,
127and
128.Sy uname
129or
130.Sy uid ,
131.Sy device
132(in the case of block or character devices), and
133.Sy link
134(in the case of symbolic links).
135If
136.Sy time
137isn't provided, the current time will be used.
138If
139.Sy flags
140isn't provided, the current file flags will be used.
141Missing regular file entries will be created as zero-length files.
142.It Fl f Ar free-files
143Ensure that a minimum of
144.Ar free-files
145free files (inodes) exist in the image.
146An optional
147.Ql %
148suffix may be provided to indicate that
149.Ar free-files
150indicates a percentage of the calculated image size.
151.It Fl M Ar minimum-size
152Set the minimum size of the file system image to
153.Ar minimum-size .
154.It Fl m Ar maximum-size
155Set the maximum size of the file system image to
156.Ar maximum-size .
157An error will be raised if the target file system needs to be larger
158than this to accommodate the provided directory tree.
159.It Fl N Ar userdb-dir
160Use the user database text file
161.Pa master.passwd
162and group database text file
163.Pa group
164from
165.Ar userdb-dir ,
166rather than using the results from the system's
167.Xr getpwnam 3
168and
169.Xr getgrnam 3
170(and related) library calls.
171.It Fl o Ar fs-options
172Set file system specific options.
173.Ar fs-options
174is a comma separated list of options.
175Valid file system specific options are detailed below.
176.It Fl S Ar sector-size
177Set the file system sector size to
178.Ar sector-size .
179.\" XXX: next line also true for cd9660?
180Defaults to 512.
181.It Fl s Ar image-size
182Set the size of the file system image to
183.Ar image-size .
184.It Fl t Ar fs-type
185Create an
186.Ar fs-type
187file system image.
188The following file system types are supported:
189.Bl -tag -width cd9660 -offset indent
190.It Sy ffs
191BSD fast file system (default).
192.It Sy cd9660
193ISO 9660 file system.
194.It Sy v7fs
1957th Edition(V7) file system.
196.El
197.It Fl x
198Exclude file system nodes not explicitly listed in the specfile.
199.El
200.Pp
201Where sizes are specified, a decimal number of bytes is expected.
202Two or more numbers may be separated by an
203.Dq x
204to indicate a product.
205Each number may have one of the following optional suffixes:
206.Bl -tag -width 3n -offset indent -compact
207.It b
208Block; multiply by 512
209.It k
210Kibi; multiply by 1024 (1 KiB)
211.It m
212Mebi; multiply by 1048576 (1 MiB)
213.It g
214Gibi; multiply by 1073741824 (1 GiB)
215.It t
216Tebi; multiply by 1099511627776 (1 TiB)
217.It w
218Word; multiply by the number of bytes in an integer
219.El
220.\"
221.\"
222.Ss FFS-specific options
223.Sy ffs
224images have ffs-specific optional parameters that may be provided.
225Each of the options consists of a keyword, an equal sign
226.Pq Ql = ,
227and a value.
228The following keywords are supported:
229.Pp
230.Bl -tag -width optimization -offset indent -compact
231.It Sy avgfilesize
232Expected average file size.
233.It Sy avgfpdir
234Expected number of files per directory.
235.It Sy bsize
236Block size.
237.It Sy density
238Bytes per inode.
239.It Sy fsize
240Fragment size.
241.It Sy label
242Label name of the image.
243.It Sy maxbpg
244Maximum blocks per file in a cylinder group.
245.It Sy minfree
246Minimum % free.
247.It Sy optimization
248Optimization preference; one of
249.Ql space
250or
251.Ql time .
252.It Sy extent
253Maximum extent size.
254.It Sy maxbpcg
255Maximum total number of blocks in a cylinder group.
256.It Sy version
257UFS version.
2581 for FFS (default), 2 for UFS2.
259.El
260.Ss CD9660-specific options
261.Sy cd9660
262images have ISO9660-specific optional parameters that may be
263provided.
264The arguments consist of a keyword and, optionally, an equal sign
265.Pq Ql = ,
266and a value.
267The following keywords are supported:
268.Pp
269.Bl -tag -width omit-trailing-period -offset indent -compact
270.It Sy allow-deep-trees
271Allow the directory structure to exceed the maximum specified in
272the spec.
273.\" .It Sy allow-illegal-chars
274.\" Unknown
275.\" .It Sy allow-lowercase
276.\" Unknown
277.It Sy allow-max-name
278Allow 37 instead of 33 characters for filenames by omitting the
279version id.
280.It Sy allow-multidot
281Allow multiple dots in a filename.
282.It Sy applicationid
283Application ID of the image.
284.It Sy archimedes
285Use the
286.Ql ARCHIMEDES
287extension to encode
288.Tn RISC OS
289metadata.
290.It Sy chrp-boot
291Write an MBR partition table to the image to allow older CHRP hardware to
292boot.
293.It Sy boot-load-segment
294Set load segment for the boot image.
295.It Sy bootimage
296Filename of a boot image in the format
297.Dq sysid;filename ,
298where
299.Dq sysid
300is one of
301.Ql i386 ,
302.Ql mac68k ,
303.Ql macppc ,
304or
305.Ql powerpc .
306.It Sy generic-bootimage
307Load a generic boot image into the first 32K of the cd9660 image.
308.It Sy hard-disk-boot
309Boot image is a hard disk image.
310.It Sy keep-bad-images
311Don't throw away images whose write was aborted due to an error.
312For debugging purposes.
313.It Sy label
314Label name of the image.
315.It Sy no-boot
316Boot image is not bootable.
317.It Sy no-emul-boot
318Boot image is a
319.Dq no emulation
320ElTorito image.
321.It Sy no-trailing-padding
322Do not pad the image (apparently Linux needs the padding).
323.\" .It Sy omit-trailing-period
324.\" Unknown
325.It Sy preparer
326Preparer ID of the image.
327.It Sy publisher
328Publisher ID of the image.
329.It Sy rockridge
330Use RockRidge extensions (for longer filenames, etc.).
331.It Sy volumeid
332Volume set identifier of the image.
333.El
334.Ss V7FS-specific options
335The following keywords are supported:
336.Pp
337.Bl -tag -width optimization -offset indent -compact
338.It Sy pdp
339PDP endian.
340.It Sy progress
341Display a progress meter for the file system construction and file
342population.
343.El
344.Sh SEE ALSO
345.Xr strsuftoll 3 ,
346.Xr installboot 8 ,
347.Xr mtree 8 ,
348.Xr newfs 8
349.Sh HISTORY
350The
351.Nm
352utility appeared in
353.Nx 1.6 .
354.Sh AUTHORS
355.An Luke Mewburn
356.Aq lukem@NetBSD.org
357(original program),
358.An Daniel Watt ,
359.An Walter Deignan ,
360.An Ryan Gabrys ,
361.An Alan Perez-Rathke ,
362.An Ram Vedam
363(cd9660 support),
364.An UCHIYAMA Yasushi
365(v7fs support).
366