xref: /netbsd-src/usr.sbin/makefs/makefs.8 (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1.\"	$NetBSD: makefs.8,v 1.64 2019/11/06 21:04:22 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 November 6, 2019
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 rxZ
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 offset
54.Op Fl o Ar fs-options
55.Op Fl S Ar sector-size
56.Op Fl s Ar image-size
57.Op Fl T Ar timestamp
58.Op Fl t Ar fs-type
59.Ar image-file
60.Ar directory
61.Op Ar extra-directory ...
62.Sh DESCRIPTION
63The utility
64.Nm
65creates a file system image into
66.Ar image-file
67from the directory tree
68.Ar directory .
69If any optional directory trees are passed in the
70.Ar extra-directory
71arguments, then the directory tree of each argument will be merged
72into the
73.Ar directory
74first before creating
75.Ar image-file .
76No special devices or privileges are required to perform this task.
77.Pp
78The options are as follows:
79.Bl -tag -width flag
80.It Fl B Ar endian
81Set the byte order of the image to
82.Ar endian .
83Valid byte orders are
84.Ql 4321 ,
85.Ql big ,
86or
87.Ql be
88for big endian, and
89.Ql 1234 ,
90.Ql little ,
91or
92.Ql le
93for little endian.
94Some file systems may have a fixed byte order; in those cases this
95argument will be ignored.
96.It Fl b Ar free-blocks
97Ensure that a minimum of
98.Ar free-blocks
99free blocks exist in the image.
100An optional
101.Ql %
102suffix may be provided to indicate that
103.Ar free-blocks
104indicates a percentage of the calculated image size.
105.It Fl d Ar debug-mask
106Enable various levels of debugging, depending upon which bits are
107set in
108.Ar debug-mask .
109XXX: document these
110.It Fl F Ar mtree-specfile
111Use
112.Ar mtree-specfile
113as an
114.Xr mtree 8
115.Sq specfile
116specification.
117.Pp
118If a specfile entry exists in the underlying file system, its
119permissions and modification time will be used unless specifically
120overridden by the specfile.
121An error will be raised if the type of entry in the specfile
122conflicts with that of an existing entry.
123.Pp
124In the opposite case (where a specfile entry does not have an entry
125in the underlying file system) the following occurs:
126If the specfile entry is marked
127.Sy optional ,
128the specfile entry is ignored.
129Otherwise, the entry will be created in the image, and it is
130necessary to specify at least the following parameters in the
131specfile:
132.Sy type ,
133.Sy mode ,
134.Sy gname ,
135or
136.Sy gid ,
137and
138.Sy uname
139or
140.Sy uid ,
141.Sy device
142(in the case of block or character devices), and
143.Sy link
144(in the case of symbolic links).
145If
146.Sy time
147isn't provided, the current time will be used.
148If
149.Sy flags
150isn't provided, the current file flags will be used.
151Missing regular file entries will be created as zero-length files.
152.It Fl f Ar free-files
153Ensure that a minimum of
154.Ar free-files
155free files (inodes) exist in the image.
156An optional
157.Ql %
158suffix may be provided to indicate that
159.Ar free-files
160indicates a percentage of the calculated image size.
161.It Fl M Ar minimum-size
162Set the minimum size of the file system image to
163.Ar minimum-size .
164.It Fl m Ar maximum-size
165Set the maximum size of the file system image to
166.Ar maximum-size .
167An error will be raised if the target file system needs to be larger
168than this to accommodate the provided directory tree.
169.It Fl N Ar userdb-dir
170Use the user database text file
171.Pa master.passwd
172and group database text file
173.Pa group
174from
175.Ar userdb-dir ,
176rather than using the results from the system's
177.Xr getpwnam 3
178and
179.Xr getgrnam 3
180(and related) library calls.
181.It Fl O Ar offset
182Instead of creating the file system at the beginning of the file, start
183at offset.
184Valid only for
185.Sy ffs
186and
187.Sy msdos .
188.It Fl o Ar fs-options
189Set file system specific options.
190.Ar fs-options
191is a comma separated list of options.
192Valid file system specific options are detailed below.
193.It Fl r
194When merging multiple directories replace duplicate files with the last found.
195.It Fl S Ar sector-size
196Set the file system sector size to
197.Ar sector-size .
198.\" XXX: next line also true for cd9660?
199Defaults to 512.
200.It Fl s Ar image-size
201Set the size of the file system image to
202.Ar image-size .
203This is equivalent of setting both the minimum
204.Fl ( M )
205and the maximum
206.Fl ( m )
207sizes to
208.Ar image-size .
209For
210.Sy ffs
211and
212.Sy msdos
213the
214.Ar offset
215is not included on that size.
216.It Fl T Ar timestamp
217Specify a timestamp to be set for all file system files and directories
218created so that repeatable builds are possible.
219The
220.Ar timestamp
221can be a
222.Pa pathname ,
223where the timestamps are derived from that file, a parseable date
224for
225.Xr parsedate 3
226(this option is not yet available in the tools build), or an integer
227value interpreted as the number of seconds from the Epoch.
228Note that timestamps specified in an
229.Xr mtree 5
230spec file, override the default timestamp.
231When this option is enabled, file systems that regularly use
232.Xr localtime 3
233to convert times to the native format (such as udf and cd9660), use
234.Xr gmtime 3
235instead with the specified timestamps so that they are immune to
236timezone changes and get consistent timestamps.
237.It Fl t Ar fs-type
238Create an
239.Ar fs-type
240file system image.
241The following file system types are supported:
242.Bl -tag -width cd9660 -offset indent
243.It Sy cd9660
244ISO 9660 file system.
245.It Sy chfs
246Chip flash file system.
247.It Sy ffs
248BSD fast file system (default).
249.It Sy msdos
250FAT12, FAT16, or FAT32 file system.
251.It Sy udf
252ISO/Ecma UDF file system.
253.It Sy v7fs
2547th Edition(V7) file system.
255.El
256.It Fl x
257Exclude file system nodes not explicitly listed in the specfile.
258.It Fl Z
259Create a sparse file for
260.Sy ffs .
261This is useful for virtual machine images.
262.El
263.Pp
264Where sizes are specified, a decimal number of bytes is expected.
265Two or more numbers may be separated by an
266.Sq x
267to indicate a product.
268Each number may have one of the following optional suffixes:
269.Bl -tag -width 3n -offset indent -compact
270.It b
271Block; multiply by 512
272.It k
273Kibi; multiply by 1024 (1 KiB)
274.It m
275Mebi; multiply by 1048576 (1 MiB)
276.It g
277Gibi; multiply by 1073741824 (1 GiB)
278.It t
279Tebi; multiply by 1099511627776 (1 TiB)
280.It w
281Word; multiply by the number of bytes in an integer
282.El
283.\"
284.\"
285.Ss FFS-specific options
286.Sy ffs
287images have ffs-specific optional parameters that may be provided.
288Each of the options consists of a keyword, an equal sign
289.Pq Ql = ,
290and a value.
291The following keywords are supported:
292.Pp
293.Bl -tag -width optimization -offset indent -compact
294.It Sy avgfilesize
295Expected average file size.
296.It Sy avgfpdir
297Expected number of files per directory.
298.It Sy bsize
299Block size.
300.It Sy density
301Bytes per inode.
302.It Sy extent
303Maximum extent size.
304.It Sy fsize
305Fragment size.
306.It Sy label
307Label name of the image.
308.It Sy maxbpcg
309Maximum total number of blocks in a cylinder group.
310.It Sy maxbpg
311Maximum blocks per file in a cylinder group.
312.It Sy minfree
313Minimum % free.
314.It Sy optimization
315Optimization preference; one of
316.Ql space
317or
318.Ql time .
319.It Sy version
320UFS version.
3211 for FFS (default), 2 for UFS2.
322.El
323.Ss CD9660-specific options
324.Sy cd9660
325images have ISO9660-specific optional parameters that may be
326provided.
327The arguments consist of a keyword and, optionally, an equal sign
328.Pq Ql = ,
329and a value.
330The following keywords are supported:
331.Pp
332.Bl -tag -width omit-trailing-period -offset indent -compact
333.It Sy allow-deep-trees
334Allow the directory structure to exceed the maximum specified in
335the spec.
336.\" .It Sy allow-illegal-chars
337.\" Unknown
338.\" .It Sy allow-lowercase
339.\" Unknown
340.It Sy allow-max-name
341Allow 37 instead of 33 characters for filenames by omitting the
342version ID.
343.It Sy allow-multidot
344Allow multiple dots in a filename.
345.It Sy applicationid
346Application ID of the image.
347.It Sy archimedes
348Use the
349.Ql ARCHIMEDES
350extension to encode
351.Tn RISC OS
352metadata.
353.It Sy boot-load-segment
354Set load segment for the boot image.
355.It Sy bootimage
356Filename of a boot image in the format
357.Dq sysid;filename ,
358where
359.Dq sysid
360is one of
361.Ql i386 ,
362.Ql mac68k ,
363.Ql macppc ,
364or
365.Ql powerpc .
366.It Sy chrp-boot
367Write an MBR partition table to the image to allow older CHRP hardware to
368boot.
369.It Sy generic-bootimage
370Load a generic boot image into the first 32K of the cd9660 image.
371.It Sy hard-disk-boot
372Boot image is a hard disk image.
373.It Sy keep-bad-images
374Don't throw away images whose write was aborted due to an error.
375For debugging purposes.
376.It Sy label
377Label name of the image.
378.It Sy no-boot
379Boot image is not bootable.
380.It Sy no-emul-boot
381Boot image is a
382.Dq no emulation
383ElTorito image.
384.It Sy no-trailing-padding
385Do not pad the image (apparently Linux needs the padding).
386.\" .It Sy omit-trailing-period
387.\" Unknown
388.It Sy platformid
389Set platform ID of section header entry of the boot image.
390.It Sy preparer
391Preparer ID of the image.
392.It Sy publisher
393Publisher ID of the image.
394.It Sy rockridge
395Use RockRidge extensions (for longer filenames, etc.).
396.It Sy volumeid
397Volume set identifier of the image.
398.El
399.Ss CHFS-specific options
400.Sy chfs
401images have chfs-specific optional parameters that may be provided.
402Each of the options consists of a keyword, an equal sign
403.Pq Ql = ,
404and a value.
405The following keywords are supported:
406.Pp
407.Bl -tag -width optimization -offset indent -compact
408.It Sy pagesize
409Pagesize.
410.It Sy erasesize
411Erase block size of the media.
412.It Sy mediatype
413Type of the media.
414NOR: 0 or NAND: 1.
415.El
416.Ss msdos-specific options
417.Sy msdos
418images have MS-DOS-specific optional parameters that may be
419provided.
420The arguments consist of a keyword, an equal sign
421.Pq Ql = ,
422and a value.
423The following keywords are supported (see
424.Xr newfs_msdos 8
425for more details):
426.Pp
427.Bl -tag -width omit-trailing-period -offset indent -compact
428.It Cm backup_sector
429Location of the backup boot sector.
430.It Cm block_size
431Block size.
432.It Cm bootstrap
433Bootstrap file.
434.It Cm bytes_per_sector
435Bytes per sector.
436.It Cm create_size
437Create file size.
438.It Cm directory_entries
439Directory entries.
440.It Cm drive_heads
441Drive heads.
442.It Cm fat_type
443FAT type (12, 16, or 32).
444.It Cm floppy
445Preset drive parameters for standard format floppy disks
446(160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880).
447.It Cm hidden_sectors
448Hidden sectors.
449.It Cm info_sector
450Location of the info sector.
451.It Cm media_descriptor
452Media descriptor.
453.It Cm num_FAT
454Number of FATs.
455.It Cm OEM_string
456OEM string.
457.It Cm offset
458Offset in device.
459.It Cm reserved_sectors
460Reserved sectors.
461.It Cm sectors_per_cluster
462Sectors per cluster.
463.It Cm sectors_per_fat
464Sectors per FAT.
465.It Cm sectors_per_track
466Sectors per track.
467.It Cm size
468File System size.
469.It Cm volume_id
470Volume ID.
471.It Cm volume_label
472Volume Label.
473.El
474.Ss V7FS-specific options
475The following keywords are supported:
476.Pp
477.Bl -tag -width optimization -offset indent -compact
478.It Sy pdp
479PDP endian.
480.It Sy progress
481Display a progress meter for the file system construction and file
482population.
483.El
484.Ss UDF-specific options
485.Sy udf
486images have udf-specific optional parameters that may be provided.
487Each of the options consists of a keyword, an equal sign
488.Pq Ql = ,
489and a value.
490The following keywords are supported:
491.Pp
492.Bl -tag -width optimization -compact
493.It Sy disctype
494This can have the following values:
495.Bl -tag -width cdromXdvdromXbdromXXX -compact
496.It Sy cdrom , Sy dvdrom , Sy bdrom
497create a read-only fs
498.It Sy dvdram , Sy bdre , Sy disk
499create a rewritable fs without sparing for defective sectors
500.It Sy cdr , Sy dvdr , Sy bdr
501create a rewritable fs on once recordable media using a VAT
502.It Sy cdrw , Sy dvdrw
503create a rewritable fs with sparing for defective sectors
504.El
505When an optical media is selected here, the sectorsize and the default disc
506size is assumed unless given explicitly.
507For rom images the disc size is the minimum needed.
508.It Sy loglabel
509Set the logical volume label of the disc to the specified argument.
510.It Sy discid
511Set the physical volume label of the disc to the specified argument.
512Prepend the physical volume label with a volumeset label separated
513with a ':' if wanted.
514For strict conformance and interchange, don't set the volumeset label
515manually unless it has an unique hex number in the first 8 character
516positions.
517.It Sy minver
518Set the minimum UDF version to be used.
519Choose UDF version numbers from 0x102, 0x150, 0x200, and 0x201.
520Versions 0x250 and 0x260 are currently not supported
521in
522.Nm .
523.El
524.Sh SEE ALSO
525.Xr strsuftoll 3 ,
526.Xr installboot 8 ,
527.Xr mtree 8 ,
528.Xr newfs 8
529.Sh HISTORY
530The
531.Nm
532utility appeared in
533.Nx 1.6 .
534.Sh AUTHORS
535.An Luke Mewburn
536.Aq lukem@NetBSD.org
537(original program),
538.An Daniel Watt ,
539.An Walter Deignan ,
540.An Ryan Gabrys ,
541.An Alan Perez-Rathke ,
542.An Ram Vedam
543(cd9660 support),
544.An UCHIYAMA Yasushi
545(v7fs support),
546.An Tamas Toth
547(chfs support),
548.An Christos Zoulas
549(msdos support),
550.An Reinoud Zandijk
551(udf support).
552