1.\" $NetBSD: makefs.8,v 1.61 2017/02/12 14:45:09 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 February 11, 2017 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. 218When this option is enabled, file systems that regularly use 219.Xr localtime 3 220to convert times to the native format (such as udf and cd9660), use 221.Xr gmtime 3 222instead with the specified timestamps so that they are immune to 223timezone changes and get consistent timestamps. 224.It Fl t Ar fs-type 225Create an 226.Ar fs-type 227file system image. 228The following file system types are supported: 229.Bl -tag -width cd9660 -offset indent 230.It Sy cd9660 231ISO 9660 file system. 232.It Sy chfs 233Chip flash file system. 234.It Sy ffs 235BSD fast file system (default). 236.It Sy msdos 237FAT12, FAT16, or FAT32 file system. 238.It Sy udf 239ISO/Ecma UDF file system. 240.It Sy v7fs 2417th Edition(V7) file system. 242.El 243.It Fl x 244Exclude file system nodes not explicitly listed in the specfile. 245.It Fl Z 246Create a sparse file for 247.Sy ffs . 248This is useful for virtual machine images. 249.El 250.Pp 251Where sizes are specified, a decimal number of bytes is expected. 252Two or more numbers may be separated by an 253.Sq x 254to indicate a product. 255Each number may have one of the following optional suffixes: 256.Bl -tag -width 3n -offset indent -compact 257.It b 258Block; multiply by 512 259.It k 260Kibi; multiply by 1024 (1 KiB) 261.It m 262Mebi; multiply by 1048576 (1 MiB) 263.It g 264Gibi; multiply by 1073741824 (1 GiB) 265.It t 266Tebi; multiply by 1099511627776 (1 TiB) 267.It w 268Word; multiply by the number of bytes in an integer 269.El 270.\" 271.\" 272.Ss FFS-specific options 273.Sy ffs 274images have ffs-specific optional parameters that may be provided. 275Each of the options consists of a keyword, an equal sign 276.Pq Ql = , 277and a value. 278The following keywords are supported: 279.Pp 280.Bl -tag -width optimization -offset indent -compact 281.It Sy avgfilesize 282Expected average file size. 283.It Sy avgfpdir 284Expected number of files per directory. 285.It Sy bsize 286Block size. 287.It Sy density 288Bytes per inode. 289.It Sy extent 290Maximum extent size. 291.It Sy fsize 292Fragment size. 293.It Sy label 294Label name of the image. 295.It Sy maxbpcg 296Maximum total number of blocks in a cylinder group. 297.It Sy maxbpg 298Maximum blocks per file in a cylinder group. 299.It Sy minfree 300Minimum % free. 301.It Sy optimization 302Optimization preference; one of 303.Ql space 304or 305.Ql time . 306.It Sy version 307UFS version. 3081 for FFS (default), 2 for UFS2. 309.El 310.Ss CD9660-specific options 311.Sy cd9660 312images have ISO9660-specific optional parameters that may be 313provided. 314The arguments consist of a keyword and, optionally, an equal sign 315.Pq Ql = , 316and a value. 317The following keywords are supported: 318.Pp 319.Bl -tag -width omit-trailing-period -offset indent -compact 320.It Sy allow-deep-trees 321Allow the directory structure to exceed the maximum specified in 322the spec. 323.\" .It Sy allow-illegal-chars 324.\" Unknown 325.\" .It Sy allow-lowercase 326.\" Unknown 327.It Sy allow-max-name 328Allow 37 instead of 33 characters for filenames by omitting the 329version ID. 330.It Sy allow-multidot 331Allow multiple dots in a filename. 332.It Sy applicationid 333Application ID of the image. 334.It Sy archimedes 335Use the 336.Ql ARCHIMEDES 337extension to encode 338.Tn RISC OS 339metadata. 340.It Sy boot-load-segment 341Set load segment for the boot image. 342.It Sy bootimage 343Filename of a boot image in the format 344.Dq sysid;filename , 345where 346.Dq sysid 347is one of 348.Ql i386 , 349.Ql mac68k , 350.Ql macppc , 351or 352.Ql powerpc . 353.It Sy chrp-boot 354Write an MBR partition table to the image to allow older CHRP hardware to 355boot. 356.It Sy generic-bootimage 357Load a generic boot image into the first 32K of the cd9660 image. 358.It Sy hard-disk-boot 359Boot image is a hard disk image. 360.It Sy keep-bad-images 361Don't throw away images whose write was aborted due to an error. 362For debugging purposes. 363.It Sy label 364Label name of the image. 365.It Sy no-boot 366Boot image is not bootable. 367.It Sy no-emul-boot 368Boot image is a 369.Dq no emulation 370ElTorito image. 371.It Sy no-trailing-padding 372Do not pad the image (apparently Linux needs the padding). 373.\" .It Sy omit-trailing-period 374.\" Unknown 375.It Sy platformid 376Set platform ID of section header entry of the boot image. 377.It Sy preparer 378Preparer ID of the image. 379.It Sy publisher 380Publisher ID of the image. 381.It Sy rockridge 382Use RockRidge extensions (for longer filenames, etc.). 383.It Sy volumeid 384Volume set identifier of the image. 385.El 386.Ss CHFS-specific options 387.Sy chfs 388images have chfs-specific optional parameters that may be provided. 389Each of the options consists of a keyword, an equal sign 390.Pq Ql = , 391and a value. 392The following keywords are supported: 393.Pp 394.Bl -tag -width optimization -offset indent -compact 395.It Sy pagesize 396Pagesize. 397.It Sy erasesize 398Erase block size of the media. 399.It Sy mediatype 400Type of the media. 401NOR: 0 or NAND: 1. 402.El 403.Ss msdos-specific options 404.Sy msdos 405images have MS-DOS-specific optional parameters that may be 406provided. 407The arguments consist of a keyword, an equal sign 408.Pq Ql = , 409and a value. 410The following keywords are supported (see 411.Xr newfs_msdos 8 412for more details): 413.Pp 414.Bl -tag -width omit-trailing-period -offset indent -compact 415.It Cm backup_sector 416Location of the backup boot sector. 417.It Cm block_size 418Block size. 419.It Cm bootstrap 420Bootstrap file. 421.It Cm bytes_per_sector 422Bytes per sector. 423.It Cm create_size 424Create file size. 425.It Cm directory_entries 426Directory entries. 427.It Cm drive_heads 428Drive heads. 429.It Cm fat_type 430FAT type (12, 16, or 32). 431.It Cm floppy 432Preset drive parameters for standard format floppy disks 433(160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880). 434.It Cm hidden_sectors 435Hidden sectors. 436.It Cm info_sector 437Location of the info sector. 438.It Cm media_descriptor 439Media descriptor. 440.It Cm num_FAT 441Number of FATs. 442.It Cm OEM_string 443OEM string. 444.It Cm offset 445Offset in device. 446.It Cm reserved_sectors 447Reserved sectors. 448.It Cm sectors_per_cluster 449Sectors per cluster. 450.It Cm sectors_per_fat 451Sectors per FAT. 452.It Cm sectors_per_track 453Sectors per track. 454.It Cm size 455File System size. 456.It Cm volume_id 457Volume ID. 458.It Cm volume_label 459Volume Label. 460.El 461.Ss V7FS-specific options 462The following keywords are supported: 463.Pp 464.Bl -tag -width optimization -offset indent -compact 465.It Sy pdp 466PDP endian. 467.It Sy progress 468Display a progress meter for the file system construction and file 469population. 470.El 471.Ss UDF-specific options 472.Sy udf 473images have udf-specific optional parameters that may be provided. 474Each of the options consists of a keyword, an equal sign 475.Pq Ql = , 476and a value. 477The following keywords are supported: 478.Pp 479.Bl -tag -width optimization -compact 480.It Sy disctype 481This can have the following values: 482.Bl -tag -width cdromXdvdromXbdromXXX -compact 483.It Sy cdrom , Sy dvdrom , Sy bdrom 484create a read-only fs 485.It Sy dvdram , Sy bdre , Sy disk 486create a rewritable fs without sparing for defective sectors 487.It Sy cdr , Sy dvdr , Sy bdr 488create a rewritable fs on once recordable media using a VAT 489.It Sy cdrw , Sy dvdrw 490create a rewritable fs with sparing for defective sectors 491.El 492When an optical media is selected here, the sectorsize and the default disc 493size is assumed unless given explicitly. 494For rom images the disc size is the minimum needed. 495.It Sy loglabel 496Set the logical volume label of the disc to the specified argument. 497.It Sy discid 498Set the physical volume label of the disc to the specified argument. 499Prepend the physical volume label with a volumeset label separated 500with a ':' if wanted. 501For strict conformance and interchange, don't set the volumeset label 502manually unless it has an unique hex number in the first 8 character 503positions. 504.It Sy minver 505Set the minimum UDF version to be used. 506Choose UDF version numbers from 0x102, 0x150, 0x200, and 0x201. 507Versions 0x250 and 0x260 are currently not supported 508in 509.Nm . 510.El 511.Sh SEE ALSO 512.Xr strsuftoll 3 , 513.Xr installboot 8 , 514.Xr mtree 8 , 515.Xr newfs 8 516.Sh HISTORY 517The 518.Nm 519utility appeared in 520.Nx 1.6 . 521.Sh AUTHORS 522.An Luke Mewburn 523.Aq lukem@NetBSD.org 524(original program), 525.An Daniel Watt , 526.An Walter Deignan , 527.An Ryan Gabrys , 528.An Alan Perez-Rathke , 529.An Ram Vedam 530(cd9660 support), 531.An UCHIYAMA Yasushi 532(v7fs support), 533.An Tamas Toth 534(chfs support), 535.An Christos Zoulas 536(msdos support), 537.An Reinoud Zandijk 538(udf support). 539