NetBSD/usr.sbin/makefs/makefs.8

552 lines
14 KiB
Groff

.\" $NetBSD: makefs.8,v 1.63 2017/04/14 07:09:43 wiz Exp $
.\"
.\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
.\" All rights reserved.
.\"
.\" Written by Luke Mewburn for Wasabi Systems, Inc.
.\"
.\" 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 for the NetBSD Project by
.\" Wasabi Systems, Inc.
.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
.\" or promote products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
.\" 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 April 13, 2017
.Dt MAKEFS 8
.Os
.Sh NAME
.Nm makefs
.Nd create a file system image from a directory tree
.Sh SYNOPSIS
.Nm
.Op Fl rxZ
.Op Fl B Ar endian
.Op Fl b Ar free-blocks
.Op Fl d Ar debug-mask
.Op Fl F Ar mtree-specfile
.Op Fl f Ar free-files
.Op Fl M Ar minimum-size
.Op Fl m Ar maximum-size
.Op Fl N Ar userdb-dir
.Op Fl O Ar offset
.Op Fl o Ar fs-options
.Op Fl S Ar sector-size
.Op Fl s Ar image-size
.Op Fl T Ar timestamp
.Op Fl t Ar fs-type
.Ar image-file
.Ar directory
.Op Ar extra-directory ...
.Sh DESCRIPTION
The utility
.Nm
creates a file system image into
.Ar image-file
from the directory tree
.Ar directory .
If any optional directory trees are passed in the
.Ar extra-directory
arguments, then the directory tree of each argument will be merged
into the
.Ar directory
first before creating
.Ar image-file .
No special devices or privileges are required to perform this task.
.Pp
The options are as follows:
.Bl -tag -width flag
.It Fl B Ar endian
Set the byte order of the image to
.Ar endian .
Valid byte orders are
.Ql 4321 ,
.Ql big ,
or
.Ql be
for big endian, and
.Ql 1234 ,
.Ql little ,
or
.Ql le
for little endian.
Some file systems may have a fixed byte order; in those cases this
argument will be ignored.
.It Fl b Ar free-blocks
Ensure that a minimum of
.Ar free-blocks
free blocks exist in the image.
An optional
.Ql %
suffix may be provided to indicate that
.Ar free-blocks
indicates a percentage of the calculated image size.
.It Fl d Ar debug-mask
Enable various levels of debugging, depending upon which bits are
set in
.Ar debug-mask .
XXX: document these
.It Fl F Ar mtree-specfile
Use
.Ar mtree-specfile
as an
.Xr mtree 8
.Sq specfile
specification.
.Pp
If a specfile entry exists in the underlying file system, its
permissions and modification time will be used unless specifically
overridden by the specfile.
An error will be raised if the type of entry in the specfile
conflicts with that of an existing entry.
.Pp
In the opposite case (where a specfile entry does not have an entry
in the underlying file system) the following occurs:
If the specfile entry is marked
.Sy optional ,
the specfile entry is ignored.
Otherwise, the entry will be created in the image, and it is
necessary to specify at least the following parameters in the
specfile:
.Sy type ,
.Sy mode ,
.Sy gname ,
or
.Sy gid ,
and
.Sy uname
or
.Sy uid ,
.Sy device
(in the case of block or character devices), and
.Sy link
(in the case of symbolic links).
If
.Sy time
isn't provided, the current time will be used.
If
.Sy flags
isn't provided, the current file flags will be used.
Missing regular file entries will be created as zero-length files.
.It Fl f Ar free-files
Ensure that a minimum of
.Ar free-files
free files (inodes) exist in the image.
An optional
.Ql %
suffix may be provided to indicate that
.Ar free-files
indicates a percentage of the calculated image size.
.It Fl M Ar minimum-size
Set the minimum size of the file system image to
.Ar minimum-size .
.It Fl m Ar maximum-size
Set the maximum size of the file system image to
.Ar maximum-size .
An error will be raised if the target file system needs to be larger
than this to accommodate the provided directory tree.
.It Fl N Ar userdb-dir
Use the user database text file
.Pa master.passwd
and group database text file
.Pa group
from
.Ar userdb-dir ,
rather than using the results from the system's
.Xr getpwnam 3
and
.Xr getgrnam 3
(and related) library calls.
.It Fl O Ar offset
Instead of creating the file system at the beginning of the file, start
at offset.
Valid only for
.Sy ffs
and
.Sy msdos .
.It Fl o Ar fs-options
Set file system specific options.
.Ar fs-options
is a comma separated list of options.
Valid file system specific options are detailed below.
.It Fl r
When merging multiple directories replace duplicate files with the last found.
.It Fl S Ar sector-size
Set the file system sector size to
.Ar sector-size .
.\" XXX: next line also true for cd9660?
Defaults to 512.
.It Fl s Ar image-size
Set the size of the file system image to
.Ar image-size .
This is equivalent of setting both the minimum
.Fl ( m )
and the maximum
.Fl ( M )
sizes to
.Ar image-size .
For
.Sy ffs
and
.Sy msdos
the
.Ar offset
is not included on that size.
.It Fl T Ar timestamp
Specify a timestamp to be set for all file system files and directories
created so that repeatable builds are possible.
The
.Ar timestamp
can be a
.Pa pathname ,
where the timestamps are derived from that file, a parseable date
for
.Xr parsedate 3
(this option is not yet available in the tools build), or an integer
value interpreted as the number of seconds from the Epoch.
Note that timestamps specified in an
.Xr mtree 5
spec file, override the default timestamp.
When this option is enabled, file systems that regularly use
.Xr localtime 3
to convert times to the native format (such as udf and cd9660), use
.Xr gmtime 3
instead with the specified timestamps so that they are immune to
timezone changes and get consistent timestamps.
.It Fl t Ar fs-type
Create an
.Ar fs-type
file system image.
The following file system types are supported:
.Bl -tag -width cd9660 -offset indent
.It Sy cd9660
ISO 9660 file system.
.It Sy chfs
Chip flash file system.
.It Sy ffs
BSD fast file system (default).
.It Sy msdos
FAT12, FAT16, or FAT32 file system.
.It Sy udf
ISO/Ecma UDF file system.
.It Sy v7fs
7th Edition(V7) file system.
.El
.It Fl x
Exclude file system nodes not explicitly listed in the specfile.
.It Fl Z
Create a sparse file for
.Sy ffs .
This is useful for virtual machine images.
.El
.Pp
Where sizes are specified, a decimal number of bytes is expected.
Two or more numbers may be separated by an
.Sq x
to indicate a product.
Each number may have one of the following optional suffixes:
.Bl -tag -width 3n -offset indent -compact
.It b
Block; multiply by 512
.It k
Kibi; multiply by 1024 (1 KiB)
.It m
Mebi; multiply by 1048576 (1 MiB)
.It g
Gibi; multiply by 1073741824 (1 GiB)
.It t
Tebi; multiply by 1099511627776 (1 TiB)
.It w
Word; multiply by the number of bytes in an integer
.El
.\"
.\"
.Ss FFS-specific options
.Sy ffs
images have ffs-specific optional parameters that may be provided.
Each of the options consists of a keyword, an equal sign
.Pq Ql = ,
and a value.
The following keywords are supported:
.Pp
.Bl -tag -width optimization -offset indent -compact
.It Sy avgfilesize
Expected average file size.
.It Sy avgfpdir
Expected number of files per directory.
.It Sy bsize
Block size.
.It Sy density
Bytes per inode.
.It Sy extent
Maximum extent size.
.It Sy fsize
Fragment size.
.It Sy label
Label name of the image.
.It Sy maxbpcg
Maximum total number of blocks in a cylinder group.
.It Sy maxbpg
Maximum blocks per file in a cylinder group.
.It Sy minfree
Minimum % free.
.It Sy optimization
Optimization preference; one of
.Ql space
or
.Ql time .
.It Sy version
UFS version.
1 for FFS (default), 2 for UFS2.
.El
.Ss CD9660-specific options
.Sy cd9660
images have ISO9660-specific optional parameters that may be
provided.
The arguments consist of a keyword and, optionally, an equal sign
.Pq Ql = ,
and a value.
The following keywords are supported:
.Pp
.Bl -tag -width omit-trailing-period -offset indent -compact
.It Sy allow-deep-trees
Allow the directory structure to exceed the maximum specified in
the spec.
.\" .It Sy allow-illegal-chars
.\" Unknown
.\" .It Sy allow-lowercase
.\" Unknown
.It Sy allow-max-name
Allow 37 instead of 33 characters for filenames by omitting the
version ID.
.It Sy allow-multidot
Allow multiple dots in a filename.
.It Sy applicationid
Application ID of the image.
.It Sy archimedes
Use the
.Ql ARCHIMEDES
extension to encode
.Tn RISC OS
metadata.
.It Sy boot-load-segment
Set load segment for the boot image.
.It Sy bootimage
Filename of a boot image in the format
.Dq sysid;filename ,
where
.Dq sysid
is one of
.Ql i386 ,
.Ql mac68k ,
.Ql macppc ,
or
.Ql powerpc .
.It Sy chrp-boot
Write an MBR partition table to the image to allow older CHRP hardware to
boot.
.It Sy generic-bootimage
Load a generic boot image into the first 32K of the cd9660 image.
.It Sy hard-disk-boot
Boot image is a hard disk image.
.It Sy keep-bad-images
Don't throw away images whose write was aborted due to an error.
For debugging purposes.
.It Sy label
Label name of the image.
.It Sy no-boot
Boot image is not bootable.
.It Sy no-emul-boot
Boot image is a
.Dq no emulation
ElTorito image.
.It Sy no-trailing-padding
Do not pad the image (apparently Linux needs the padding).
.\" .It Sy omit-trailing-period
.\" Unknown
.It Sy platformid
Set platform ID of section header entry of the boot image.
.It Sy preparer
Preparer ID of the image.
.It Sy publisher
Publisher ID of the image.
.It Sy rockridge
Use RockRidge extensions (for longer filenames, etc.).
.It Sy volumeid
Volume set identifier of the image.
.El
.Ss CHFS-specific options
.Sy chfs
images have chfs-specific optional parameters that may be provided.
Each of the options consists of a keyword, an equal sign
.Pq Ql = ,
and a value.
The following keywords are supported:
.Pp
.Bl -tag -width optimization -offset indent -compact
.It Sy pagesize
Pagesize.
.It Sy erasesize
Erase block size of the media.
.It Sy mediatype
Type of the media.
NOR: 0 or NAND: 1.
.El
.Ss msdos-specific options
.Sy msdos
images have MS-DOS-specific optional parameters that may be
provided.
The arguments consist of a keyword, an equal sign
.Pq Ql = ,
and a value.
The following keywords are supported (see
.Xr newfs_msdos 8
for more details):
.Pp
.Bl -tag -width omit-trailing-period -offset indent -compact
.It Cm backup_sector
Location of the backup boot sector.
.It Cm block_size
Block size.
.It Cm bootstrap
Bootstrap file.
.It Cm bytes_per_sector
Bytes per sector.
.It Cm create_size
Create file size.
.It Cm directory_entries
Directory entries.
.It Cm drive_heads
Drive heads.
.It Cm fat_type
FAT type (12, 16, or 32).
.It Cm floppy
Preset drive parameters for standard format floppy disks
(160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880).
.It Cm hidden_sectors
Hidden sectors.
.It Cm info_sector
Location of the info sector.
.It Cm media_descriptor
Media descriptor.
.It Cm num_FAT
Number of FATs.
.It Cm OEM_string
OEM string.
.It Cm offset
Offset in device.
.It Cm reserved_sectors
Reserved sectors.
.It Cm sectors_per_cluster
Sectors per cluster.
.It Cm sectors_per_fat
Sectors per FAT.
.It Cm sectors_per_track
Sectors per track.
.It Cm size
File System size.
.It Cm volume_id
Volume ID.
.It Cm volume_label
Volume Label.
.El
.Ss V7FS-specific options
The following keywords are supported:
.Pp
.Bl -tag -width optimization -offset indent -compact
.It Sy pdp
PDP endian.
.It Sy progress
Display a progress meter for the file system construction and file
population.
.El
.Ss UDF-specific options
.Sy udf
images have udf-specific optional parameters that may be provided.
Each of the options consists of a keyword, an equal sign
.Pq Ql = ,
and a value.
The following keywords are supported:
.Pp
.Bl -tag -width optimization -compact
.It Sy disctype
This can have the following values:
.Bl -tag -width cdromXdvdromXbdromXXX -compact
.It Sy cdrom , Sy dvdrom , Sy bdrom
create a read-only fs
.It Sy dvdram , Sy bdre , Sy disk
create a rewritable fs without sparing for defective sectors
.It Sy cdr , Sy dvdr , Sy bdr
create a rewritable fs on once recordable media using a VAT
.It Sy cdrw , Sy dvdrw
create a rewritable fs with sparing for defective sectors
.El
When an optical media is selected here, the sectorsize and the default disc
size is assumed unless given explicitly.
For rom images the disc size is the minimum needed.
.It Sy loglabel
Set the logical volume label of the disc to the specified argument.
.It Sy discid
Set the physical volume label of the disc to the specified argument.
Prepend the physical volume label with a volumeset label separated
with a ':' if wanted.
For strict conformance and interchange, don't set the volumeset label
manually unless it has an unique hex number in the first 8 character
positions.
.It Sy minver
Set the minimum UDF version to be used.
Choose UDF version numbers from 0x102, 0x150, 0x200, and 0x201.
Versions 0x250 and 0x260 are currently not supported
in
.Nm .
.El
.Sh SEE ALSO
.Xr strsuftoll 3 ,
.Xr installboot 8 ,
.Xr mtree 8 ,
.Xr newfs 8
.Sh HISTORY
The
.Nm
utility appeared in
.Nx 1.6 .
.Sh AUTHORS
.An Luke Mewburn
.Aq lukem@NetBSD.org
(original program),
.An Daniel Watt ,
.An Walter Deignan ,
.An Ryan Gabrys ,
.An Alan Perez-Rathke ,
.An Ram Vedam
(cd9660 support),
.An UCHIYAMA Yasushi
(v7fs support),
.An Tamas Toth
(chfs support),
.An Christos Zoulas
(msdos support),
.An Reinoud Zandijk
(udf support).