NEWFS_MSDOS(8) BSD System Manager's Manual NEWFS_MSDOS(8)NAMEnewfs_msdos — construct a new MS-DOS (FAT) file system
SYNOPSISnewfs_msdos [-N] [-@ offset] [-B boot] [-C create-size] [-F FAT-type]
[-I VolumeId] [-L label] [-O OEM] [-S sector-size]
[-a FAT-size] [-b block-size] [-c cluster-size] [-e DirEnts]
[-f format] [-h heads] [-i info] [-k backup] [-m media]
[-n FATs] [-o hidden] [-r reserved] [-s total]
[-u track-size] special [disktype]
DESCRIPTION
The newfs_msdos utility creates a FAT12, FAT16, or FAT32 file system on
device or file named special, using disktab(5) entry disktype to deter‐
mine geometry, if required.
If special does not contain a / and -C is not used, it is assumed to be a
device name and /dev/ is prepended to the name to construct the actual
device name. To work a file in the current directory use ./filename
The options are as follow:
-N Do not create a file system: just print out parameters.
-@ 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.
-B boot
Get bootstrap from file.
-C create-size
Create the image file with the specified size. A suffix charac‐
ter appended to the size is interpreted as for the -@ 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.
-F FAT-type
FAT type (one of 12, 16, or 32).
-I VolumeID
Volume ID, a 32 bit number in decimal or hexadecimal (0x...) for‐
mat.
-L label
Volume label (up to 11 characters). The label should consist of
only those characters permitted in regular DOS (8+3) filenames.
-O OEM OEM string (up to 8 characters). The default is "BSD 4.4".
-S sector-size
Number of bytes per sector. Acceptable values are powers of 2 in
the range 512 through 32768, inclusive.
-a FAT-size
Number of sectors per FAT.
-b block-size
File system block size (bytes per cluster). This should resolve
to an acceptable number of sectors per cluster (see below).
-c cluster-size
Sectors per cluster. Acceptable values are powers of 2 in the
range 1 through 128. If the block or cluster size are not speci‐
fied, the code uses a cluster between 512 bytes and 32K depending
on the filesystem size.
-e DirEnts
Number of root directory entries (FAT12 and FAT16 only).
-f format
Specify a standard (floppy disk) format. The standard formats
are (capacities in kilobytes): 160, 180, 320, 360, 640, 720,
1200, 1232, 1440, 2880.
-h heads
Number of drive heads.
-i info
Location of the file system info sector (FAT32 only). A value of
0xffff signifies no info sector.
-k backup
Location of the backup boot sector (FAT32 only). A value of
0xffff signifies no backup sector.
-m media
Media descriptor (acceptable range 0xf0 to 0xff).
-n FATs
Number of FATs. Acceptable values are 1 to 16 inclusive. The
default is 2.
-o hidden
Number of hidden sectors.
-r reserved
Number of reserved sectors.
-s total
File system size.
-u track-size
Number of sectors per track.
NOTES
If some parameters (e.g. size, number of sectors, etc.) are not specified
through options or disktype, the program tries to generate them automati‐
cally. In particular, the size is determined as the device or file size
minus the offset specified with the -@ 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.
FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter
Block)" in the first of the "reserved" sectors which precede the actual
file system. For reference purposes, this structure is presented below.
struct bsbpb {
u_int16_t bps; /* [-S] bytes per sector */
u_int8_t spc; /* [-c] sectors per cluster */
u_int16_t res; /* [-r] reserved sectors */
u_int8_t nft; /* [-n] number of FATs */
u_int16_t rde; /* [-e] root directory entries */
u_int16_t sec; /* [-s] total sectors */
u_int8_t mid; /* [-m] media descriptor */
u_int16_t spf; /* [-a] sectors per FAT */
u_int16_t spt; /* [-u] sectors per track */
u_int16_t hds; /* [-h] drive heads */
u_int32_t hid; /* [-o] hidden sectors */
u_int32_t bsec; /* [-s] big total sectors */
};
/* FAT32 extensions */
struct bsxbpb {
u_int32_t bspf; /* [-a] big sectors per FAT */
u_int16_t xflg; /* control flags */
u_int16_t vers; /* file system version */
u_int32_t rdcl; /* root directory start cluster */
u_int16_t infs; /* [-i] file system info sector */
u_int16_t bkbs; /* [-k] backup boot sector */
};
LIMITATION
The maximum file size is 4GB, even if the file system itself is bigger.
EXIT STATUS
Exit status is 0 on success and 1 on error.
EXAMPLES
Create a file system, using default parameters, on /dev/ad0s1:
newfs_msdos /dev/ad0s1
Create a standard 1.44M file system, with volume label foo, on /dev/fd0:
newfs_msdos-f 1440 -L foo fd0
Create a 30MB image file, with the FAT partition starting 63 sectors
within the image file:
newfs_msdos-C 30M -@63s ./somefile
SEE ALSOdisktab(5), disklabel(8), fdisk(8), newfs(8)HISTORY
The newfs_msdos utility first appeared in FreeBSD 3.0.
AUTHORS
Robert Nordier ⟨rnordier@FreeBSD.org⟩.
BSD July 25, 2010 BSD