| NEWFS_MSDOS(8) | System Manager's Manual | NEWFS_MSDOS(8) | 
newfs_msdos —
| newfs_msdos | [ -N] [-@offset] [-Bboot] [-Ccreate-size] [-FFAT-type] [-Ivolid] [-Llabel] [-OOEM] [-Ssector-size] [-aFAT-size] [-bblock-size] [-ccluster-size] [-edirents] [-fformat] [-hheads] [-iinfo] [-kbackup] [-mmedia] [-nFATs] [-ohidden] [-rreserved] [-stotal] [-Ttimestamp] [-utrack-size] special
      [disktype] | 
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.
The options are as follow:
-N-@
    offset-B
    boot-C
    create-size-@ option.
      The file is created by truncating any existing file with the same name,
      seeking just before the required size and writing a single 0 byte. As a
      consequence, the space occupied on disk may be smaller than the size
      specified as a parameter.-F
    FAT-type-I
    volid-L
    labelNO NAME”.-O
    OEMNetBSD”.-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-T
    AT&T UNIX timestamp-u
    track-sizeIf newfs_msdos receives a
    SIGINFO signal (see the status
    argument for stty(1)), a line
    will be written to the standard error output indicating the name of the
    device currently being formatted, the sector number being written, and the
    total number of sectors to be written.
-@ 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
  file system 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 */
};
newfs_msdos /dev/rwd1a
Create a file system, using default parameters, on /dev/rwd1a.
newfs_msdos -f 1440 -L foo /dev/rfd0a
Create a standard 1.44M file system, with volume label foo, on /dev/rfd0a. Create a 30MB image file, with the FAT partition starting 63 sectors within the image file:
newfs_msdos -C 30M -@63s ./somefile
newfs_msdos utility appeared in
  FreeBSD 3.0. The newfs_msdos
  command first appeared in NetBSD 1.3.
| February 16, 2017 | NetBSD 9.4 |