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
- Install the version of Fedora that is to be tested on a bare metal or virtual system.
- Install the
dosfstools
package using the command:sudo dnf install dosfstools
. - 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
- Create a FAT32 filesystem on the test device or file:
sudo mkfs.fat -F 32 fat.img
. - Mount the newly created filesystem:
mkdir mnt
&&sudo mount -o loop fat.img mnt/
- Write some data to the filesystem:
sudo touch mnt/testfile
&&sudo echo "This is a test" > mnt/testfile
- Unmount the filesystem:
sudo umount mnt
- Check the filesystem for errors:
sudo fsck.fat -v fat.img
- (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
- The
dosfstools
package installs without error. - The
mkfs.fat
command successfully creates a FAT32 filesystem without errors. - The new filesystem can be successfully mounted and written to.
- 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
- Test with different FAT types (e.g.,
-F 12
,-F 16
,-F 32
). - Test on different physical devices (USB sticks, SD cards) as well as loopback files.
- Test large filesystems (e.g., greater than 32 GB for FAT32).
- Test the behavior when the device is nearly full.
- Test additional
fsck.fat
options for different types of checks and repairs.