NetBSD/sbin/newfs_msdos/newfs_msdos.8

138 lines
4.6 KiB
Groff
Raw Normal View History

1999-03-10 08:14:51 +03:00
.\" $NetBSD: newfs_msdos.8,v 1.6 1999/03/10 05:17:27 erh Exp $
.\"
.\" Copyright (c) 1997 Christos Zoulas
.\" 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.
.\"
1998-04-29 13:49:10 +04:00
.\" Id: mkdosfs.1,v 1.5 1997/02/22 16:06:38 peter Exp
.\"
.Dd February 25, 1997
.Os
.Dt NEWFS_MSDOS 8
.Sh NAME
.Nm newfs_msdos
.Nd create an MS-DOS (FAT) file system
.Sh SYNOPSIS
.Nm
.Bq Fl f Ar capacity
.Bq Fl L Ar vollabel
.Ar device
.Sh DESCRIPTION
1998-04-29 13:49:10 +04:00
.Nm
establishes a file system structure on
.Ar device
that is understood by
1998-04-29 13:49:10 +04:00
.Xr mount_msdos 8
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 ,
1998-04-29 13:49:10 +04:00
although any existing writable file or device is acceptable.
In case of a regular file it is treated as a dumped image of an
.Tn 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
1998-04-29 13:49:10 +04:00
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
1998-04-29 13:49:10 +04:00
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.
1998-04-29 13:49:10 +04:00
.It Em The File Allocation Table(s) (FAT)
Sectors next to the
.Em bootsector
1998-04-29 13:49:10 +04:00
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
1998-04-29 13:49:10 +04:00
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
initializes it to empty, and enters a volume label record into the
very first directory slot.
1999-03-10 08:14:51 +03:00
.El
.Sh DIAGNOSTICS
1998-04-29 13:49:10 +04:00
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 fsck_msdos 8 ,
.Xr mount_msdos 8 ,
.Xr newfs 8
.Sh BUGS
There is currently no way to specify obscure file system parameters.
1998-04-29 13:49:10 +04:00
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
1998-04-29 13:49:10 +04:00
No attempt is made to handle media defects.
.Sh HISTORY
.Nm
appeared in
.Fx 2.2 .
.Sh AUTHOR
The program has been contributed by
.if n Joerg Wunsch,
.if t J\(:org Wunsch,
Dresden.