xref: /openbsd-src/usr.sbin/makefs/makefs.8 (revision fdb36351d33ed7543a1f275c280c425f56e0cf34)
1.\"	$OpenBSD: makefs.8,v 1.21 2023/04/25 08:57:11 krw Exp $
2.\"	$NetBSD: makefs.8,v 1.55 2015/11/25 16:32:00 wiz Exp $
3.\"
4.\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
5.\" All rights reserved.
6.\"
7.\" Written by Luke Mewburn for Wasabi Systems, Inc.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"      This product includes software developed for the NetBSD Project by
20.\"      Wasabi Systems, Inc.
21.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
22.\"    or promote products derived from this software without specific prior
23.\"    written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd $Mdocdate: April 25 2023 $
38.Dt MAKEFS 8
39.Os
40.Sh NAME
41.Nm makefs
42.Nd create a file system image from a directory tree
43.Sh SYNOPSIS
44.Nm
45.Op Fl b Ar free-blocks
46.Op Fl f Ar free-files
47.Op Fl M Ar minimum-size
48.Op Fl m Ar maximum-size
49.Op Fl O Ar offset
50.Op Fl o Ar fs-options
51.Op Fl S Ar sector-size
52.Op Fl s Ar image-size
53.Op Fl T Ar timestamp
54.Op Fl t Ar fs-type
55.Ar image-file
56.Ar directory
57.Sh DESCRIPTION
58The utility
59.Nm
60creates a file system image into
61.Ar image-file
62from the directory tree
63.Ar directory .
64No special devices or privileges are required to perform this task.
65.Pp
66The options are as follows:
67.Bl -tag -width flag
68.It Fl b Ar free-blocks
69Ensure that a minimum of
70.Ar free-blocks
71exist in the image.
72An optional
73.Ql %
74suffix may be provided to indicate that
75.Ar free-blocks
76indicates a percentage of the calculated image size.
77.It Fl f Ar free-files
78Ensure that a minimum of
79.Ar free-files
80(inodes) exist in the image.
81An optional
82.Ql %
83suffix may be provided to indicate that
84.Ar free-files
85indicates a percentage of the calculated image size.
86.It Fl M Ar minimum-size
87Set the minimum size of the file system image to
88.Ar minimum-size .
89.It Fl m Ar maximum-size
90Set the maximum size of the file system image to
91.Ar maximum-size .
92An error will be raised if the target file system needs to be larger
93than this to accommodate the provided directory tree.
94.It Fl O Ar offset
95Instead of creating the file system at the beginning of the file, start
96at offset.
97Valid only for
98.Sy ffs
99and
100.Sy msdos .
101.It Fl o Ar fs-options
102Set file system specific options.
103.Ar fs-options
104is a comma separated list of options.
105Valid file system specific options are detailed below.
106.It Fl S Ar sector-size
107Set the file system sector size to
108.Ar sector-size .
109.\" XXX: next line also true for cd9660?
110Defaults to 512.
111.It Fl s Ar image-size
112Set the size of the file system image to
113.Ar image-size .
114.It Fl T Ar timestamp
115Specify a timestamp to be set for all file system files and directories
116created so that repeatable builds are possible.
117The
118.Ar timestamp
119is an integer value interpreted as the number of seconds from the Epoch.
120.It Fl t Ar fs-type
121Create an
122.Ar fs-type
123file system image.
124The following file system types are supported:
125.Pp
126.Bl -tag -width cd9660 -offset indent -compact
127.It Sy cd9660
128ISO 9660 file system.
129.It Sy ffs
130BSD Fast File System (the default).
131.It Sy msdos
132FAT12, FAT16, or FAT32 file system.
133.El
134.El
135.Pp
136Sizes are specified as a decimal number of bytes
137and may use a multiplier, as documented in
138.Xr scan_scaled 3 .
139Two or more numbers may be separated by an
140.Sq x
141to indicate a product.
142.Ss ffs options
143.Sy ffs
144images have ffs-specific optional parameters that may be provided.
145Each of the options consists of a keyword, an equal sign
146.Pq Ql = ,
147and a value.
148The following keywords are supported:
149.Pp
150.Bl -tag -width optimization -offset indent -compact
151.It Sy avgfilesize
152Expected average file size.
153.It Sy avgfpdir
154Expected number of files per directory.
155.It Sy bsize
156Block size.
157.It Sy density
158Bytes per inode.
159.It Sy disklabel
160Name of a disk described in
161.Xr disktab 5 .
162A disklabel with the information will be written at a machine dependent
163location in the image.
164The size of the file system image, the sector size and the
165.Sy bsize
166and
167.Sy fsize
168parameters are inferred from the disklabel.
169.It Sy extent
170Maximum extent size.
171.It Sy fsize
172Fragment size.
173.It Sy label
174Label name of the image.
175.It Sy maxbpcg
176Maximum total number of blocks in a cylinder group.
177.It Sy maxbpg
178Maximum blocks per file in a cylinder group.
179.It Sy minfree
180Minimum % free.
181.It Sy optimization
182Optimization preference: one of
183.Ql space
184(default)
185or
186.Ql time .
187.It Sy rdroot
188A disklabel appropriate for a ramdisk will be built and
189written at a machine dependent location in the image.
190The filesystem will be described by a FS_BSDFFS partition
191.Sq a ,
192with defaults offset=0, fsize=512, bsize=4096, minfree=0 and density=4096.
193.It Sy version
194UFS version.
1951 for FFS (default) or 2 for UFS2.
196.El
197.Ss cd9660 options
198.Sy cd9660
199images have ISO9660-specific optional parameters that may be
200provided.
201The arguments consist of a keyword and, optionally, an equal sign
202.Pq Ql = ,
203and a value.
204The following keywords are supported:
205.Pp
206.Bl -tag -width omit-trailing-period -offset indent -compact
207.It Sy allow-deep-trees
208Allow the directory structure to exceed the maximum specified in
209the spec.
210.It Sy allow-multidot
211Allow multiple dots in a filename.
212.It Sy applicationid
213Application ID of the image.
214.It Sy boot-load-segment
215Set load segment for the boot image.
216.It Sy bootimage
217Filename of a boot image in the format
218.Dq sysid;filename ,
219where
220.Dq sysid
221is one of
222.Ql i386 ,
223.Ql macppc ,
224.Ql powerpc ,
225or
226.Ql efi .
227.It Sy generic-bootimage
228Load a generic boot image into the first 32K of the CD9660 image.
229.It Sy hard-disk-boot
230Boot image is a hard disk image.
231.It Sy isolevel
232ISO Level.
233.It Sy label
234Label name of the image.
235.It Sy no-boot
236Boot image is not bootable.
237.It Sy no-emul-boot
238Boot image is a
239.Dq no emulation
240ElTorito image.
241.It Sy no-trailing-padding
242Do not pad the image (apparently Linux needs the padding).
243.It Sy omit-trailing-period
244Omit trailing periods in filenames.
245.It Sy preparer
246Preparer ID of the image.
247.It Sy publisher
248Publisher ID of the image.
249.It Sy rockridge
250Use RockRidge extensions (for longer filenames, etc.).
251.It Sy volumeid
252Volume set identifier of the image.
253.El
254.Ss msdos options
255.Sy msdos
256images have MS-DOS-specific optional parameters that may be
257provided.
258The arguments consist of a keyword, an equal sign
259.Pq Ql = ,
260and a value.
261The following keywords are supported:
262.Pp
263.Bl -tag -width omit-trailing-period -offset indent -compact
264.It Cm backup_sector
265Location of the backup boot sector.
266.It Cm block_size
267Block size.
268.It Cm bootstrap
269Bootstrap file.
270.It Cm bytes_per_sector
271Bytes per sector.
272.It Cm create_size
273Create file size.
274.It Cm directory_entries
275Directory entries.
276.It Cm drive_heads
277Drive heads.
278.It Cm fat_type
279FAT type (12, 16, or 32).
280.It Cm floppy
281Preset drive parameters for standard format floppy disks
282(160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880).
283.It Cm hidden_sectors
284Hidden sectors.
285.It Cm info_sector
286Location of the info sector.
287.It Cm media_descriptor
288Media descriptor.
289.It Cm num_FAT
290Number of FATs.
291.It Cm OEM_string
292OEM string.
293.It Cm offset
294Offset in device.
295.It Cm reserved_sectors
296Reserved sectors.
297.It Cm sectors_per_cluster
298Sectors per cluster.
299.It Cm sectors_per_fat
300Sectors per FAT.
301.It Cm sectors_per_track
302Sectors per track.
303.It Cm size
304File System size.
305.It Cm volume_id
306Volume ID.
307.It Cm volume_label
308Volume Label.
309.El
310.Sh SEE ALSO
311.Xr scan_scaled 3 ,
312.Xr installboot 8 ,
313.Xr newfs 8
314.Sh HISTORY
315The
316.Nm
317utility appeared in
318.Nx 1.6 .
319.Sh AUTHORS
320.An -nosplit
321.An Luke Mewburn
322.Aq lukem@NetBSD.org
323(original program),
324.An Daniel Watt ,
325.An Walter Deignan ,
326.An Ryan Gabrys ,
327.An Alan Perez-Rathke ,
328.An Ram Vedam
329(cd9660 support),
330and
331.An Christos Zoulas
332(msdos support).
333