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