MirBSD manpage: newfs_msdos(8)

NEWFS_MSDOS(8)           BSD System Manager's Manual            NEWFS_MSDOS(8)


     newfs_msdos - construct a new MS-DOS (FAT) filesystem


     newfs_msdos [-N] [-B boot] [-F FAT-type] [-I volid] [-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 filesystem on
     device special, using disktab(5) entry disktype to determine geometry, if

     The options are as follows:

     -N      Don't create a filesystem: just print out parameters.

     -B boot
             Get bootstrap from file.

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

     -I volid
             Volume ID.

     -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 128 through 32768. Conformant values are 512, 1024,
             2048 and 4096; only 512 is portable.

     -a FAT-size
             Number of sectors per FAT.

     -b block-size
             Filesystem block size (bytes per cluster). This should resolve to
             an acceptable number of sectors per cluster (see below). Confor-
             mant values are powers of 2 no larger than 32768.

     -c cluster-size
             Sectors per cluster. Acceptable values are powers of 2 in the
             range 1 through 128. Conformant values are 1, 2, 4, 8, 16, 32, 64
             for 512-byte sectors.

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

     -f format
             Specify a standard (floppy disk) format. The eight standard for-
             mats are (capacities in Kibibytes): 160, 180, 320, 360, 720,
             1200, 1440, 2880.

     -h heads
             Number of drive heads.

     -i info
             Location of the filesystem 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 de-
             fault is 2.

     -o hidden
             Number of hidden sectors.

     -r reserved
             Number of reserved sectors.

     -s total
             Filesystem size.

     -u track-size
             Number of sectors per track.


     FAT filesystem parameters occupy a "Boot Sector BPB (BIOS Parameter
     Block)" in the first of the "reserved" sectors which precede the actual
     filesystem. 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;           /* filesystem version */
             u_int32_t       rdcl;           /* root directory start cluster */
             u_int16_t       infs;           /* [-i] filesystem info sector */
             u_int16_t       bkbs;           /* [-k] backup boot sector */


     Create a filesystem, using default parameters, on /dev/rwd0i.
           newfs_msdos /dev/rwd0i

     Create a standard 1.44M filesystem, with volume label "foo", on
           newfs_msdos -f 1440 -L foo fd0c


     Exit status is 0 on success and 1 on error.


     disktab(5), disklabel(8), fdisk(8), newfs(8)


     The newfs_msdos command first appeared in OpenBSD 2.1.


     Robert Nordier <rnordier@FreeBSD.org>.


     newfs_msdos will happily create a non-conformant filesystem, for example
     a 2 GiB FAT16 filesystem with 65536 bytes per cluster, which cannot be
     read on most systems.

MirBSD #10-current              August 7, 2017                               2

Generated on 2021-12-07 11:07:08 by $MirOS: src/scripts/roff2htm,v 1.103 2021/01/23 20:24:35 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2021 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.