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