1.\" $NetBSD: makefs.8,v 1.13 2004/02/13 17:56:18 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 March 30, 2003 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.Bk -words 45.Op Fl t Ar fs-type 46.Ek 47.Bk -words 48.Op Fl o Ar fs-options 49.Ek 50.Bk -words 51.Op Fl d Ar debug-mask 52.Ek 53.Bk -words 54.Op Fl B Ar byte-order 55.Ek 56.Bk -words 57.Op Fl S Ar sector-size 58.Ek 59.Bk -words 60.Op Fl M Ar minimum-size 61.Ek 62.Bk -words 63.Op Fl m Ar maximum-size 64.Ek 65.Bk -words 66.Op Fl s Ar image-size 67.Ek 68.Bk -words 69.Op Fl b Ar free-blocks 70.Ek 71.Bk -words 72.Op Fl f Ar free-files 73.Ek 74.Bk -words 75.Op Fl F Ar specfile 76.Ek 77.Op Fl x 78.Bk -words 79.Op Fl N Ar userdb-dir 80.Ek 81.Ar image-file 82.Ar directory 83.Sh DESCRIPTION 84The utility 85.Nm 86creates a file system image into 87.Ar image-file 88from the directory tree 89.Ar directory . 90No special devices or privileges are required to perform this task. 91.Pp 92The options are as follows: 93.Bl -tag -width flag 94.It Fl t Ar fs-type 95Create an 96.Ar fs-type 97file system image. 98The following file system types are supported: 99.Bl -tag -width ffs -offset indent 100.It Sy ffs 101BSD fast file system (default). 102.El 103.It Fl o Ar fs-options 104Set file system specific options. 105.Ar fs-options 106is a comma separated list of options. 107Valid file system specific options are detailed below. 108.It Fl d Ar debug-mask 109Enable various levels of debugging, depending upon which bits are set 110in 111.Ar debug-mask . 112XXX: document these 113.It Fl B Ar byte-order 114Set the byte order of the image to 115.Ar byte-order . 116Valid byte orders are 117.Ql 4321 , 118.Ql big 119or 120.Ql be 121for big endian, and 122.Ql 1234 , 123.Ql little 124or 125.Ql le 126for little endian. 127Some file systems may have a fixed byte order; in those cases this 128argument will be ignored. 129.It Fl S Ar sector-size 130Set the file system sector size to 131.Ar sector-size . 132Defaults to 512. 133.It Fl M Ar minimum-size 134Set the minimum size of the file system image to 135.Ar minimum-size . 136.It Fl m Ar maximum-size 137Set the maximum size of the file system image to 138.Ar maximum-size . 139An error will be raised if the target file system needs to be larger 140than this to accommodate the provided directory tree. 141.It Fl s Ar image-size 142Set the size of the file system image to 143.Ar image-size . 144.It Fl b Ar free-blocks 145Ensure that a minimum of 146.Ar free-blocks 147free blocks exist in the image. 148An optional 149.Ql % 150suffix may be provided to indicate that 151.Ar free-blocks 152indicates a percentage of the calculated image size 153.It Fl f Ar free-files 154Ensure that a minimum of 155.Ar free-files 156free files (inodes) exist in the image. 157An optional 158.Ql % 159suffix may be provided to indicate that 160.Ar free-blocks 161indicates a percentage of the calculated image size 162.It Fl F Ar specfile 163Use 164.Ar specfile 165as an 166.Xr mtree 8 167.Sq specfile 168specification. 169.Pp 170If a specfile entry exists in the underlying file system, its permissions and 171modification time will be used unless specifically overridden by the specfile. 172An error will be raised if the type of entry in the specfile conflicts 173with that of an existing entry. 174.Pp 175In the opposite case 176(where a specfile entry does not have an entry in the underlying file system) 177the following occurs: 178If the specfile entry is marked 179.Sy optional , 180the specfile entry is ignored. 181Otherwise, the entry will be created in the image, 182and it is necessary to specify at least the following parameters 183in the specfile: 184.Sy type , 185.Sy mode , 186.Sy gname 187or 188.Sy gid , 189and 190.Sy uname 191or 192.Sy uid , 193.Sy device 194(in the case of block or character devices), and 195.Sy link 196(in the case of symbolic links). 197If 198.Sy time 199isn't provided, the current time will be used. 200If 201.Sy flags 202isn't provided, the current file flags will be used. 203Missing regular file entries will be created as zero-length files. 204.It Fl x 205Exclude file system nodes not explcitly listed in the specfile. 206.It Fl N Ar dbdir 207Use the user database text file 208.Pa master.passwd 209and group database text file 210.Pa group 211from 212.Ar dbdir , 213rather than using the results from the system's 214.Xr getpwnam 3 215and 216.Xr getgrnam 3 217(and related) library calls. 218.El 219.Pp 220Where sizes are specified, a decimal number of bytes is expected. 221Two or more numbers may be separated by an 222.Dq x 223to indicate a product. 224Each number may have one of the following optional suffixes: 225.Bl -tag -width 3n -offset indent -compact 226.It b 227Block; multiply by 512 228.It k 229Kilo; multiply by 1024 (1 KB) 230.It m 231Mega; multiply by 1048576 (1 MB) 232.It g 233Giga; multiply by 1073741824 (1 GB) 234.It t 235Tera; multiply by 1099511627776 (1 TB) 236.It w 237Word; multiply by the number of bytes in an integer 238.El 239.\" 240.\" 241.Ss FFS-specific options 242.Sy ffs 243images have ffs-specific optional parameters that may be provided. 244Each of the options consists of a keyword, an equals sign 245.Pq Ql = , 246and a value. 247The following keywords are supported: 248.Pp 249.Bl -tag -width optimization -offset indent -compact 250.It Sy avgfilesize 251Expected average file size 252.It Sy avgfpdir 253Expected number of files per directory 254.It Sy bsize 255Block size 256.It Sy density 257Bytes per inode 258.It Sy fsize 259Fragment size 260.It Sy maxbpg 261Maximum blocks per file in a cylinder group 262.It Sy minfree 263Minimum % free 264.It Sy optimization 265Optimization preference; one of 266.Ql space 267or 268.Ql time . 269.It Sy extent 270Maximum extent size 271.It Sy maxbpcg 272Maximum total number of blocks in a cylinder group 273.It Sy version 274UFS version. 1 for FFS (default), 2 for UFS2 275.El 276.Sh SEE ALSO 277.Xr mtree 8 , 278.Xr newfs 8 279.Sh HISTORY 280The 281.Nm 282utility appeared in 283.Nx 1.6 . 284.Sh AUTHORS 285.An Luke Mewburn 286.Aq lukem@NetBSD.org . 287