1.\" $NetBSD: newfs_msdos.8,v 1.6 1999/03/10 05:17:27 erh Exp $ 2.\" 3.\" Copyright (c) 1997 Christos Zoulas 4.\" Copyright (c) 1995, 1996 Joerg Wunsch 5.\" 6.\" All rights reserved. 7.\" 8.\" This program is free software. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29.\" 30.\" Id: mkdosfs.1,v 1.5 1997/02/22 16:06:38 peter Exp 31.\" 32.Dd February 25, 1997 33.Os 34.Dt NEWFS_MSDOS 8 35.Sh NAME 36.Nm newfs_msdos 37.Nd create an MS-DOS (FAT) file system 38.Sh SYNOPSIS 39.Nm 40.Bq Fl f Ar capacity 41.Bq Fl L Ar vollabel 42.Ar device 43.Sh DESCRIPTION 44.Nm 45establishes a file system structure on 46.Ar device 47that is understood by 48.Xr mount_msdos 8 49and some ancient program loader. 50.Ar Device 51will typically be the character device node for a floppy disk drive, 52.Pq e.\ g. Pa /dev/rfd0 , 53although any existing writable file or device is acceptable. 54In case of a regular file it is treated as a dumped image of an 55.Tn MS-DOS 56file system; only the file system structure will be written to it, 57and it won't be truncated. 58.Pp 59The options are as follows: 60.Bl -tag -width 10n -offset indent 61.It Fl f Ar capacity 62Use defaults for a typical file system with 63.Ar capacity 64kilobytes. 65Currently, the values 360, 720, 1200, and 1440 are recognized. 66.Pp 67If this option is not specified, 68.Nm 69attempts to determine the size of the 70.Ar device . 71This is not reliably possible in all cases, but is believed to work 72for the more common situations. 73.It Fl L Ar vollabel 74Use 75.Ar vollabel 76to describe the file system, instead of the default 77.Ql 4.4BSD . 78.El 79.Pp 80The file system structure consists of three major areas: 81.Bl -tag -width 10n -offset indent 82.It Em The bootsector 83This is the very first (512-byte) sector. 84It contains executable 85code that normally would bootstrap an operating system when loaded. 86Since it's beyond the scope of 87.Nm 88to install an operating system on the medium, this boot code will only 89print a message that the disk does not contain a bootable system. 90Inside the 91.Em bootsector 92is the 93.Em BIOS parameter block (BPB) , 94where several statistical parameters of the file system are being 95held. 96.It Em The File Allocation Table(s) (FAT) 97Sectors next to the 98.Em bootsector 99hold the FAT, which is used to register file system allocation, as 100well as keeping pointer chains for the chunks constituting one file. 101There are usually two identical copies of the FAT. 102.It Em The root directory 103The final structure is the root directory for this medium. 104It is merely a space reservation, padded with 0's, and unfortunately fixed 105in its size. 106.Nm 107initializes it to empty, and enters a volume label record into the 108very first directory slot. 109.El 110.Sh DIAGNOSTICS 111An exit status of 0 is returned upon successful operation. 112Exit status 1 is returned on any errors during file system creation, 113and an exit status of 2 reflects invalid arguments given to the 114program (along with an appropriate information written to diagnostic 115output). 116.Sh SEE ALSO 117.Xr fdformat 1 , 118.Xr fsck_msdos 8 , 119.Xr mount_msdos 8 , 120.Xr newfs 8 121.Sh BUGS 122There is currently no way to specify obscure file system parameters. 123Thus, only media with one of the supported capacity values can be formatted. 124For the same reason, it's not possible to handle hard disk partitions. 125More options should be added to allow this. 126More entries should be added to the table of known formats, too. 127.Pp 128No attempt is made to handle media defects. 129.Sh HISTORY 130.Nm 131appeared in 132.Fx 2.2 . 133.Sh AUTHOR 134The program has been contributed by 135.if n Joerg Wunsch, 136.if t J\(:org Wunsch, 137Dresden. 138