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