From Fedora Project Wiki

Description

dosfstools includes the mkfs.fat and fsck.fat utilities, which respectively make and check MS-DOS FAT (File Allocation Table) filesystems on hard drives or on more modern media such as USB sticks. mkfs.fat is used to create a FAT filesystem on a device or in an image file, while fsck.fat is used to check and repair a FAT filesystem. This test case ensures that the dosfstools utilities are working as expected. It verifies the ability to create a FAT filesystem and to check and repair a FAT filesystem using mkfs.fat and fsck.fat.

Setup

  1. Install the version of Fedora that is to be tested on a bare metal or virtual system.
  2. Install the dosfstools package using the command: sudo dnf install dosfstools.
  3. Prepare a test device or file. For safety, this is often a loopback file rather than a physical device: dd if=/dev/zero of=fat.img bs=1M count=100.

How to test

  1. Create a FAT32 filesystem on the test device or file: sudo mkfs.fat -F 32 fat.img.
  2. Mount the newly created filesystem:mkdir mnt && sudo mount -o loop fat.img mnt/
  3. Write some data to the filesystem: sudo touch mnt/testfile &&sudo echo "This is a test" > mnt/testfile
  4. Unmount the filesystem: sudo umount mnt
  5. Check the filesystem for errors: sudo fsck.fat -v fat.img
  6. (For advanced testing) Intentionally corrupt the file system using a hex editor or similar, then use fsck.fat to attempt to repair it.

Expected Results

  1. The dosfstools package installs without error.
  2. The mkfs.fat command successfully creates a FAT32 filesystem without errors.
  3. The new filesystem can be successfully mounted and written to.
  4. The fsck.fat command checks the FAT filesystem and reports that it is clean, or successfully repairs it if it was intentionally corrupted for testing.

Optional

  1. Test with different FAT types (e.g., -F 12, -F 16, -F 32).
  2. Test on different physical devices (USB sticks, SD cards) as well as loopback files.
  3. Test large filesystems (e.g., greater than 32 GB for FAT32).
  4. Test the behavior when the device is nearly full.
  5. Test additional fsck.fat options for different types of checks and repairs.