1.\" $NetBSD: makefs.8,v 1.55 2015/11/25 16:32:00 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 November 23, 2015 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 . 203.It Fl T Ar timestamp 204Specify a timestamp to be set for all file system files and directories 205created so that repeatable builds are possible. 206The 207.Ar timestamp 208can be a 209.Pa pathname , 210where the timestamps are derived from that file, a parseable date 211for 212.Xr parsedate 3 213(this option is not yet available in the tools build), or an integer 214value interpreted as the number of seconds from the Epoch. 215Note that timestamps specified in an 216.Xr mtree 5 217spec file, override the default timestamp. 218.It Fl t Ar fs-type 219Create an 220.Ar fs-type 221file system image. 222The following file system types are supported: 223.Bl -tag -width cd9660 -offset indent 224.It Sy ffs 225BSD fast file system (default). 226.It Sy cd9660 227ISO 9660 file system. 228.It Sy chfs 229Chip flash file system. 230.It Sy msdos 231FAT12, FAT16, or FAT32 file system. 232.It Sy v7fs 2337th Edition(V7) file system. 234.It Sy udf 235ISO/Ecma UDF file system. 236.El 237.It Fl x 238Exclude file system nodes not explicitly listed in the specfile. 239.It Fl Z 240Create a sparse file for 241.Sy ffs . 242This is useful for virtual machine images. 243.El 244.Pp 245Where sizes are specified, a decimal number of bytes is expected. 246Two or more numbers may be separated by an 247.Dq x 248to indicate a product. 249Each number may have one of the following optional suffixes: 250.Bl -tag -width 3n -offset indent -compact 251.It b 252Block; multiply by 512 253.It k 254Kibi; multiply by 1024 (1 KiB) 255.It m 256Mebi; multiply by 1048576 (1 MiB) 257.It g 258Gibi; multiply by 1073741824 (1 GiB) 259.It t 260Tebi; multiply by 1099511627776 (1 TiB) 261.It w 262Word; multiply by the number of bytes in an integer 263.El 264.\" 265.\" 266.Ss FFS-specific options 267.Sy ffs 268images have ffs-specific optional parameters that may be provided. 269Each of the options consists of a keyword, an equal sign 270.Pq Ql = , 271and a value. 272The following keywords are supported: 273.Pp 274.Bl -tag -width optimization -offset indent -compact 275.It Sy avgfilesize 276Expected average file size. 277.It Sy avgfpdir 278Expected number of files per directory. 279.It Sy bsize 280Block size. 281.It Sy density 282Bytes per inode. 283.It Sy fsize 284Fragment size. 285.It Sy label 286Label name of the image. 287.It Sy maxbpg 288Maximum blocks per file in a cylinder group. 289.It Sy minfree 290Minimum % free. 291.It Sy optimization 292Optimization preference; one of 293.Ql space 294or 295.Ql time . 296.It Sy extent 297Maximum extent size. 298.It Sy maxbpcg 299Maximum total number of blocks in a cylinder group. 300.It Sy version 301UFS version. 3021 for FFS (default), 2 for UFS2. 303.El 304.Ss CD9660-specific options 305.Sy cd9660 306images have ISO9660-specific optional parameters that may be 307provided. 308The arguments consist of a keyword and, optionally, an equal sign 309.Pq Ql = , 310and a value. 311The following keywords are supported: 312.Pp 313.Bl -tag -width omit-trailing-period -offset indent -compact 314.It Sy allow-deep-trees 315Allow the directory structure to exceed the maximum specified in 316the spec. 317.\" .It Sy allow-illegal-chars 318.\" Unknown 319.\" .It Sy allow-lowercase 320.\" Unknown 321.It Sy allow-max-name 322Allow 37 instead of 33 characters for filenames by omitting the 323version id. 324.It Sy allow-multidot 325Allow multiple dots in a filename. 326.It Sy applicationid 327Application ID of the image. 328.It Sy archimedes 329Use the 330.Ql ARCHIMEDES 331extension to encode 332.Tn RISC OS 333metadata. 334.It Sy chrp-boot 335Write an MBR partition table to the image to allow older CHRP hardware to 336boot. 337.It Sy boot-load-segment 338Set load segment for the boot image. 339.It Sy bootimage 340Filename of a boot image in the format 341.Dq sysid;filename , 342where 343.Dq sysid 344is one of 345.Ql i386 , 346.Ql mac68k , 347.Ql macppc , 348or 349.Ql powerpc . 350.It Sy generic-bootimage 351Load a generic boot image into the first 32K of the cd9660 image. 352.It Sy hard-disk-boot 353Boot image is a hard disk image. 354.It Sy keep-bad-images 355Don't throw away images whose write was aborted due to an error. 356For debugging purposes. 357.It Sy label 358Label name of the image. 359.It Sy no-boot 360Boot image is not bootable. 361.It Sy no-emul-boot 362Boot image is a 363.Dq no emulation 364ElTorito image. 365.It Sy no-trailing-padding 366Do not pad the image (apparently Linux needs the padding). 367.\" .It Sy omit-trailing-period 368.\" Unknown 369.It Sy preparer 370Preparer ID of the image. 371.It Sy publisher 372Publisher ID of the image. 373.It Sy rockridge 374Use RockRidge extensions (for longer filenames, etc.). 375.It Sy volumeid 376Volume set identifier of the image. 377.El 378.Ss CHFS-specific options 379.Sy chfs 380images have chfs-specific optional parameters that may be provided. 381Each of the options consists of a keyword, an equal sign 382.Pq Ql = , 383and a value. 384The following keywords are supported: 385.Pp 386.Bl -tag -width optimization -offset indent -compact 387.It Sy pagesize 388Pagesize. 389.It Sy erasesize 390Erase block size of the media. 391.It Sy mediatype 392Type of the media. 393NOR: 0 or NAND: 1. 394.El 395.Ss msdos-specific options 396See 397.Xr newfs_msdos 8 398for fs specific options. 399.Ss V7FS-specific options 400The following keywords are supported: 401.Pp 402.Bl -tag -width optimization -offset indent -compact 403.It Sy pdp 404PDP endian. 405.It Sy progress 406Display a progress meter for the file system construction and file 407population. 408.El 409.Ss UDF-specific options 410.Sy udf 411images have udf-specific optional parameters that may be provided. 412Each of the options consists of a keyword, an equal sign 413.Pq Ql = , 414and a value. 415The following keywords are supported: 416.Pp 417.Bl -tag -width optimization -compact 418.It Sy disctype 419This can have the following values: 420.Bl -tag -width cdromXdvdromXbdromXXX -compact 421.It Sy cdrom , Sy dvdrom , Sy bdrom 422create a read-only fs 423.It Sy dvdram , Sy bdre , Sy disk 424create a rewritable fs without sparing for defective sectors 425.It Sy cdr , Sy dvdr , Sy bdr 426create a rewritable fs on once recordable media using a VAT 427.It Sy cdrw , Sy dvdrw 428create a rewritable fs with sparing for defective sectors 429.El 430When an optical media is selected here, the sectorsize and the default disc 431size is assumed unless given explicitly. 432For rom images the disc size is the minimum needed. 433.It Sy loglabel 434Set the logical volume label of the disc to the specified argument. 435.It Sy discid 436Set the physical volume label of the disc to the specified argument. 437Prepend the physical volume label with a volumeset label separated 438with a ':' if wanted. 439For strict conformance and interchange, don't set the volumeset label 440manually unless it has an unique hex number in the first 8 character 441positions. 442.It Sy minver 443Set the minimum UDF version to be used. 444Choose UDF version numbers from 0x102, 0x150, 0x200, and 0x201. 445Versions 0x250 and 0x260 are currently not supported 446in 447.Nm . 448.El 449.Sh SEE ALSO 450.Xr strsuftoll 3 , 451.Xr installboot 8 , 452.Xr mtree 8 , 453.Xr newfs 8 454.Sh HISTORY 455The 456.Nm 457utility appeared in 458.Nx 1.6 . 459.Sh AUTHORS 460.An Luke Mewburn 461.Aq lukem@NetBSD.org 462(original program), 463.An Daniel Watt , 464.An Walter Deignan , 465.An Ryan Gabrys , 466.An Alan Perez-Rathke , 467.An Ram Vedam 468(cd9660 support), 469.An UCHIYAMA Yasushi 470(v7fs support), 471.An Tamas Toth 472(chfs support). 473.An Christos Zoulas 474(msdos support). 475.An Reinoud Zandijk 476(udf support). 477