NEWFS_MSDOS(8) BSD System Manager's Manual (INtime Distributed RTOS only).
newfs_msdos | fmtfat -- construct a new MS-DOS (FAT) file system
newfs_msdos | fmtfat [-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]
The newfs_msdos utility creates a FAT12, FAT16, or FAT32 file system on device or file named special, using disktab(5) entry disktype to determine 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 fmtfat utility is the same as newfs_msdos with an 8.3 filename.
-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
If some parameters (e.g. size, number of sectors, etc.) are not specified 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 -@ 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 {
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 */
};
/* FAT32 extensions */
struct bsxbpb {
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 */
};
The maximum file size is 4GB, even if the file system itself is bigger.
Exit status is 0 on success and 1 on error.
Create a file system, using default parameters, on /dev/ada0s1:
newfs_msdos /dev/ada0s1
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
The newfs_msdos utility first appeared in FreeBSD 3.0.
Robert Nordier <rnordier@FreeBSD.org>