1998-07-06 21:01:34 +01:00
|
|
|
.\" Copyright (c) 1998 Robert Nordier
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
|
|
|
.\"
|
1999-08-28 01:22:10 +01:00
|
|
|
.\" $FreeBSD$
|
1998-07-06 21:01:34 +01:00
|
|
|
.\"
|
2013-10-01 19:41:53 +01:00
|
|
|
.Dd October 1, 2013
|
1998-07-06 21:01:34 +01:00
|
|
|
.Dt NEWFS_MSDOS 8
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm newfs_msdos
|
2002-08-21 19:11:48 +01:00
|
|
|
.Nd construct a new MS-DOS (FAT) file system
|
1998-07-06 21:01:34 +01:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1998-07-06 21:01:34 +01:00
|
|
|
.Op Fl N
|
2008-12-03 18:22:36 +00:00
|
|
|
.Op Fl @ Ar offset
|
1998-07-06 21:01:34 +01:00
|
|
|
.Op Fl B Ar boot
|
2008-12-03 18:22:36 +00:00
|
|
|
.Op Fl C Ar create-size
|
1998-07-06 21:01:34 +01:00
|
|
|
.Op Fl F Ar FAT-type
|
2010-02-14 12:25:39 +00:00
|
|
|
.Op Fl I Ar VolumeId
|
1998-07-06 21:01:34 +01:00
|
|
|
.Op Fl L Ar label
|
|
|
|
.Op Fl O Ar OEM
|
|
|
|
.Op Fl S Ar sector-size
|
|
|
|
.Op Fl a Ar FAT-size
|
|
|
|
.Op Fl b Ar block-size
|
|
|
|
.Op Fl c Ar cluster-size
|
2010-02-14 12:25:39 +00:00
|
|
|
.Op Fl e Ar DirEnts
|
1998-07-06 21:01:34 +01:00
|
|
|
.Op Fl f Ar format
|
|
|
|
.Op Fl h Ar heads
|
|
|
|
.Op Fl i Ar info
|
|
|
|
.Op Fl k Ar backup
|
|
|
|
.Op Fl m Ar media
|
|
|
|
.Op Fl n Ar FATs
|
|
|
|
.Op Fl o Ar hidden
|
|
|
|
.Op Fl r Ar reserved
|
|
|
|
.Op Fl s Ar total
|
|
|
|
.Op Fl u Ar track-size
|
|
|
|
.Ar special
|
|
|
|
.Op Ar disktype
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
2008-12-03 18:22:36 +00:00
|
|
|
utility creates a FAT12, FAT16, or FAT32 file system on device or file named
|
1998-07-06 21:01:34 +01:00
|
|
|
.Ar special ,
|
|
|
|
using
|
|
|
|
.Xr disktab 5
|
|
|
|
entry
|
|
|
|
.Ar disktype
|
|
|
|
to determine geometry, if required.
|
|
|
|
.Pp
|
2008-12-03 18:22:36 +00:00
|
|
|
If
|
|
|
|
.Ar special
|
|
|
|
does not contain a
|
2009-04-11 15:56:29 +01:00
|
|
|
.Ar /
|
|
|
|
and
|
|
|
|
.Fl C
|
|
|
|
is not used, it is assumed to be a device name and
|
|
|
|
.Ar /dev/
|
2008-12-03 18:22:36 +00:00
|
|
|
is prepended to the name to construct the actual device name.
|
|
|
|
To work a file in the current directory use
|
|
|
|
.Ar ./filename
|
|
|
|
.Pp
|
1998-07-06 21:01:34 +01:00
|
|
|
The options are as follow:
|
1998-07-15 07:30:38 +01:00
|
|
|
.Bl -tag -width indent
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl N
|
2005-02-13 22:25:33 +00:00
|
|
|
Do not create a file system: just print out parameters.
|
2008-12-03 18:22:36 +00:00
|
|
|
.It Fl @ Ar offset
|
|
|
|
Build the filesystem at the specified offset in bytes in the device or file.
|
|
|
|
A suffix s, k, m, g (lower or upper case)
|
|
|
|
appended to the offset specifies that the
|
|
|
|
number is in sectors, kilobytes, megabytes or gigabytes, respectively.
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl B Ar boot
|
|
|
|
Get bootstrap from file.
|
2008-12-03 18:22:36 +00:00
|
|
|
.It Fl C Ar create-size
|
2009-04-11 16:07:27 +01:00
|
|
|
Create the image file with the specified size.
|
|
|
|
A suffix character appended to the size is interpreted as for the
|
2008-12-03 18:22:36 +00:00
|
|
|
.Fl @
|
2009-04-11 16:03:44 +01:00
|
|
|
option.
|
|
|
|
The file is created by truncating any existing file with the same name and
|
|
|
|
resizing it to the requested size.
|
|
|
|
If the file system supports sparse files, the space occupied on disk may be
|
|
|
|
smaller than the size specified as parameter.
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl F Ar FAT-type
|
|
|
|
FAT type (one of 12, 16, or 32).
|
2010-02-14 12:25:39 +00:00
|
|
|
.It Fl I Ar VolumeID
|
2008-12-03 18:22:36 +00:00
|
|
|
Volume ID, a 32 bit number in decimal or hexadecimal (0x...) format.
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl L Ar label
|
2004-07-02 22:45:06 +01:00
|
|
|
Volume label (up to 11 characters).
|
|
|
|
The label should consist of
|
1998-07-06 21:01:34 +01:00
|
|
|
only those characters permitted in regular DOS (8+3) filenames.
|
|
|
|
.It Fl O Ar OEM
|
2004-07-02 22:45:06 +01:00
|
|
|
OEM string (up to 8 characters).
|
|
|
|
The default is
|
2001-08-14 11:01:54 +01:00
|
|
|
.Qq Li "BSD 4.4" .
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl S Ar sector-size
|
2004-07-02 22:45:06 +01:00
|
|
|
Number of bytes per sector.
|
|
|
|
Acceptable values are powers of 2
|
2010-07-25 12:31:29 +01:00
|
|
|
in the range 512 through 32768, inclusive.
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl a Ar FAT-size
|
|
|
|
Number of sectors per FAT.
|
1998-10-10 16:47:16 +01:00
|
|
|
.It Fl b Ar block-size
|
2004-07-02 22:45:06 +01:00
|
|
|
File system block size (bytes per cluster).
|
|
|
|
This should resolve to an
|
1998-07-06 21:01:34 +01:00
|
|
|
acceptable number of sectors per cluster (see below).
|
|
|
|
.It Fl c Ar cluster-size
|
2004-07-02 22:45:06 +01:00
|
|
|
Sectors per cluster.
|
|
|
|
Acceptable values are powers of 2 in the range
|
1998-07-06 21:01:34 +01:00
|
|
|
1 through 128.
|
2008-12-03 18:22:36 +00:00
|
|
|
If the block or cluster size are not specified, the code
|
|
|
|
uses a cluster between 512 bytes and 32K depending on
|
|
|
|
the filesystem size.
|
2010-02-14 12:25:39 +00:00
|
|
|
.It Fl e Ar DirEnts
|
1998-07-06 21:01:34 +01:00
|
|
|
Number of root directory entries (FAT12 and FAT16 only).
|
|
|
|
.It Fl f Ar format
|
2004-07-02 22:45:06 +01:00
|
|
|
Specify a standard (floppy disk) format.
|
|
|
|
The standard formats
|
2000-03-30 04:41:09 +01:00
|
|
|
are (capacities in kilobytes): 160, 180, 320, 360, 640, 720, 1200,
|
|
|
|
1232, 1440, 2880.
|
1998-07-06 21:01:34 +01:00
|
|
|
.It Fl h Ar heads
|
|
|
|
Number of drive heads.
|
|
|
|
.It Fl i Ar info
|
2002-08-21 19:11:48 +01:00
|
|
|
Location of the file system info sector (FAT32 only).
|
1998-07-06 21:01:34 +01:00
|
|
|
A value of 0xffff signifies no info sector.
|
|
|
|
.It Fl k Ar backup
|
2004-07-02 22:45:06 +01:00
|
|
|
Location of the backup boot sector (FAT32 only).
|
|
|
|
A value
|
1998-07-06 21:01:34 +01:00
|
|
|
of 0xffff signifies no backup sector.
|
|
|
|
.It Fl m Ar media
|
|
|
|
Media descriptor (acceptable range 0xf0 to 0xff).
|
|
|
|
.It Fl n Ar FATs
|
2004-07-02 22:45:06 +01:00
|
|
|
Number of FATs.
|
|
|
|
Acceptable values are 1 to 16 inclusive.
|
2000-03-01 11:27:47 +00:00
|
|
|
The default
|
1998-07-06 21:01:34 +01:00
|
|
|
is 2.
|
|
|
|
.It Fl o Ar hidden
|
|
|
|
Number of hidden sectors.
|
|
|
|
.It Fl r Ar reserved
|
|
|
|
Number of reserved sectors.
|
|
|
|
.It Fl s Ar total
|
|
|
|
File system size.
|
|
|
|
.It Fl u Ar track-size
|
|
|
|
Number of sectors per track.
|
|
|
|
.El
|
|
|
|
.Sh NOTES
|
2008-12-03 18:22:36 +00:00
|
|
|
If some parameters (e.g. size, number of sectors, etc.) are not specified
|
2009-04-11 16:07:27 +01:00
|
|
|
through options or disktype, the program tries to generate them automatically.
|
|
|
|
In particular, the size is determined as the device or file size minus the
|
|
|
|
offset specified with the
|
2008-12-03 18:22:36 +00:00
|
|
|
.Fl @
|
2009-04-11 16:07:27 +01:00
|
|
|
option.
|
|
|
|
When the geometry is not available, it is assumed to be 63 sectors, 255 heads.
|
|
|
|
The size is then rounded to become a multiple of the track size and avoid
|
|
|
|
complaints by some filesystem code.
|
2008-12-03 18:22:36 +00:00
|
|
|
.Pp
|
2002-08-21 19:11:48 +01:00
|
|
|
FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter
|
1998-07-06 21:01:34 +01:00
|
|
|
Block)" in the first of the "reserved" sectors which precede the actual
|
2004-07-02 22:45:06 +01:00
|
|
|
file system.
|
|
|
|
For reference purposes, this structure is presented
|
1998-07-06 21:01:34 +01:00
|
|
|
below.
|
|
|
|
.Bd -literal
|
|
|
|
struct bsbpb {
|
2012-02-12 18:29:56 +00:00
|
|
|
uint16_t bpbBytesPerSec; /* [-S] bytes per sector */
|
|
|
|
uint8_t bpbSecPerClust; /* [-c] sectors per cluster */
|
|
|
|
uint16_t bpbResSectors; /* [-r] reserved sectors */
|
|
|
|
uint8_t bpbFATs; /* [-n] number of FATs */
|
|
|
|
uint16_t bpbRootDirEnts; /* [-e] root directory entries */
|
|
|
|
uint16_t bpbSectors; /* [-s] total sectors */
|
|
|
|
uint8_t bpbMedia; /* [-m] media descriptor */
|
|
|
|
uint16_t bpbFATsecs; /* [-a] sectors per FAT */
|
|
|
|
uint16_t bpbSecPerTrack; /* [-u] sectors per track */
|
|
|
|
uint16_t bpbHeads; /* [-h] drive heads */
|
|
|
|
uint32_t bpbHiddenSecs; /* [-o] hidden sectors */
|
|
|
|
uint32_t bpbHugeSectors; /* [-s] big total sectors */
|
1998-07-06 21:01:34 +01:00
|
|
|
};
|
|
|
|
/* FAT32 extensions */
|
|
|
|
struct bsxbpb {
|
2012-02-12 18:29:56 +00:00
|
|
|
uint32_t bpbBigFATsecs; /* [-a] big sectors per FAT */
|
|
|
|
uint16_t bpbExtFlags; /* control flags */
|
|
|
|
uint16_t bpbFSVers; /* file system version */
|
|
|
|
uint32_t bpbRootClust; /* root directory start cluster */
|
|
|
|
uint16_t bpbFSInfo; /* [-i] file system info sector */
|
|
|
|
uint16_t bpbBackup; /* [-k] backup boot sector */
|
1998-07-06 21:01:34 +01:00
|
|
|
};
|
|
|
|
.Ed
|
2007-12-08 22:38:12 +00:00
|
|
|
.Sh LIMITATION
|
2007-12-09 13:34:10 +00:00
|
|
|
The maximum file size is 4GB, even if the file system itself is bigger.
|
2005-01-18 10:09:38 +00:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
Exit status is 0 on success and 1 on error.
|
1998-07-06 21:01:34 +01:00
|
|
|
.Sh EXAMPLES
|
2008-12-03 18:22:36 +00:00
|
|
|
Create a file system, using default parameters, on
|
2013-10-01 19:41:53 +01:00
|
|
|
.Pa /dev/ada0s1 :
|
2000-12-18 15:16:24 +00:00
|
|
|
.Bd -literal -offset indent
|
2013-10-01 19:41:53 +01:00
|
|
|
newfs_msdos /dev/ada0s1
|
2000-12-18 15:16:24 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2008-12-03 18:22:36 +00:00
|
|
|
Create a standard 1.44M file system, with volume label
|
|
|
|
.Ar foo ,
|
|
|
|
on
|
|
|
|
.Pa /dev/fd0 :
|
2000-12-18 15:16:24 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
newfs_msdos -f 1440 -L foo fd0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2008-12-03 18:22:36 +00:00
|
|
|
Create a 30MB image file, with the FAT partition starting
|
|
|
|
63 sectors within the image file:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
newfs_msdos -C 30M -@63s ./somefile
|
|
|
|
.Ed
|
1998-07-06 21:01:34 +01:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr disktab 5 ,
|
1998-08-31 17:41:09 +01:00
|
|
|
.Xr disklabel 8 ,
|
1998-07-06 21:01:34 +01:00
|
|
|
.Xr fdisk 8 ,
|
|
|
|
.Xr newfs 8
|
1998-09-29 18:34:25 +01:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2002-07-06 20:34:18 +01:00
|
|
|
utility first appeared in
|
1998-09-29 18:34:25 +01:00
|
|
|
.Fx 3.0 .
|
1998-07-06 21:01:34 +01:00
|
|
|
.Sh AUTHORS
|
2014-06-20 10:40:43 +01:00
|
|
|
.An Robert Nordier Aq Mt rnordier@FreeBSD.org
|