lab9 Filesystem
  • Introduction
  • Important Commands
    • File Permissions
    • Disk Duplication
    • Create FAT Filesystems
    • Check and Repair FAT filesystem
    • Mount
    • Demo
    • Viewing with Hex Editor
      • Endian-ness in FAT32
  • Linux File System Calls
  • Directory Related Calls in C Language
  • Overview of FAT32
  • Accessing FAT using C
    • C Header of FAT
      • Header: Boot Sector
      • Header: Dir Entry
      • Read the header
    • 8+3 File Name
    • Traversing Cluster
    • Finding Next Cluster
    • Reference
Powered by GitBook
On this page
  • Usage
  • Example

Was this helpful?

  1. Important Commands

Create FAT Filesystems

PreviousDisk DuplicationNextCheck and Repair FAT filesystem

Last updated 5 years ago

Was this helpful?

After creating a blank disk, we have to initalize it with a file system before we can use it.

In Linux, we have a command mkfs.vfat to format the disk to FAT.

Usage

mkfs.vfat -F FAT-size -f NUMFAT -S logical-sector-size -s sectors-per-cluster -R number-of-reserved-sectors DEVICE

You can control various parameters of the FAT filesystem.

Example

Suppose we would like to create a FAT32 file systems,with

  • 2 FATs

  • 512 bytes per sector

  • 1 sector per cluster

  • 32 Reserved sectors

mkfs.vfat -F 32 -f 2 -S 512 -s 1 -R 32 test.disk

Then the virtual disk we created earlier is now initialized.