newfs_msdos(8)

newfs_msdos8

Construct a new ms-dos (fat) file system

Usage

newfs_msdos [-N] [-a FAT-size] [-B boot] [-b block-size] [-c cluster-size] [-e dirents] [-F FAT-type] [-f format] [-h heads] [-I volid] [-i info] [-k backup] [-L label] [-m media] [-n FATs] [-O OEM] [-o hidden] [-r reserved] [-S sector-size] [-s total] [-u track-size] special [disktype]

Overview

The newfs_msdos utility creates a FAT12, FAT16, or FAT32 file system on device special, using disktab(5) entry disktype to determine geometry, if required.

The special file should be a raw device, for example /dev/rsd0i; if a relative path like sd0i is specified, the corresponding raw device is used.

The options are as follows:

-a FAT-size

Number of sectors per FAT.

-B boot

Get bootstrap from file.

-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.

-e dirents

Number of root directory entries (FAT12 and FAT16 only).

-F FAT-type

FAT type (one of 12, 16, or 32).

-f format

Specify a standard (floppy disk) format. The eight standard formats are (capacities in kilobytes): 160, 180, 320, 360, 720, 1200, 1440, 2880.

-h heads

Number of drive heads.

-I volid

Volume ID.

-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.

-L label

Volume label (up to 11 characters). The label should consist of only those characters permitted in regular DOS (8+3) filenames.

-m media

Media descriptor (acceptable range 0xf0 to 0xff).

-N

Don't create a file system: just print out parameters.

-n FATs

Number of FATs. Acceptable values are 1 to 16 inclusive. The default is 2.

-O OEM

OEM string (up to 8 characters). The default is "BSD 4.4".

-o hidden

Number of hidden sectors.

-r reserved

Number of reserved sectors.

-S sector-size

Number of bytes per sector. Acceptable values are powers of 2 in the range 512 through 32768.

-s total

File system size.

-u track-size

Number of sectors per track.

Notes

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 */
};

Examples

Create a file system, using default parameters, on /dev/rwd0i.

newfs_msdos /dev/rwd0i

Create a standard 1.44M file system, with volume label "foo", on /dev/rfd0c.

newfs_msdos -f 1440 -L foo fd0c

Diagnostics

Exit status is 0 on success and 1 on error.

Releases

61 releases since OpenBSD 2.1; the text changed 14 times.

  1. 2.1–2.3
  2. 2.4
  3. 2.5
  4. 2.6
  5. 2.7
  6. 2.8
  7. 2.9–3.0
  8. 3.1–3.2
  9. 3.3
  10. 3.4–4.1
  11. 4.2
  12. 4.3–4.6
  13. 4.7–5.3
  14. 5.4–5.5
  15. 5.6–8.0

-B since OpenBSD 2.7; -F since OpenBSD 2.7; -I since OpenBSD 2.7; -N since OpenBSD 2.7; -O since OpenBSD 2.7; -S since OpenBSD 2.7; -a since OpenBSD 2.7; -b since OpenBSD 2.7; -c since OpenBSD 2.7; -e since OpenBSD 2.7; -f since OpenBSD 2.7; -h since OpenBSD 2.7; -i since OpenBSD 2.7; -k since OpenBSD 2.7; -m since OpenBSD 2.7; -n since OpenBSD 2.7; -o since OpenBSD 2.7; -r since OpenBSD 2.7; -u since OpenBSD 2.7.

History

The newfs_msdos command first appeared in OpenBSD 2.1.

Authors

Robert Nordier ⟨[email protected]⟩.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.