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

Was this helpful?

  1. Important Commands

Demo

Now we can try the whole demo example with the following commands:

  1. Create a new file test.disk to hold the virtual drive volume by pre-filling the file with data:

    ~$ dd if=/dev/zero of=test.disk bs=64M count=1
  2. Next up we give the volume a filesystem. Here, we format it with FAT32:

    ~$ mkfs.vfat -F 32 -f 2 -S 512 -s 1 -R 32 test.disk
  3. Check the details of the FAT filesystem:

    ~$ dosfsck -v test.disk
  4. Mount: to mount the formatted file test.disk from the terminal, you will need to first create a folder to mount it to. Let’s say we want to mount it to the folder ~/rd.

** Here is the procedure:

  • First create the folder there.

    ~$ mkdir ~/rd
  • Then mount the file test.disk to the folder ~/rd:

    ~$ sudo mount -t vfat -o loop test.disk ~/rd
  • Now we can create/copy files to the drive:

    ~$ cd ~/rd
    ~/rd$ ls
    ~/rd$ sudo touch a
    ~/rd$ ls
  • When we finished, unmount the volume by running this command:

    ~/rd$ cd -
    $ sudo umount ~/rd
PreviousMountNextViewing with Hex Editor

Last updated 5 years ago

Was this helpful?

Here are the results of the demo: