Exercise: Formatting and Mounting Filesystems

Bringing a Partition to Life

A hands-on exercise on how to format a partition with different filesystems (ext4, exFAT) and make it accessible to the operating system by mounting it.
Author

Chuck Nelson

Published

October 22, 2025

1 Purpose

An empty partition is still unusable. This exercise covers the final step in preparing a drive: formatting. You will learn how to create a filesystem on the partition you created in the previous exercise. You will then learn how to mount that filesystem to make it accessible to the operating system, and how to work with different filesystem types like ext4 and exFAT.

2 What You’ll Accomplish

By the end of this exercise, you will be able to:

  • Format a partition with the ext4 and exFAT filesystems using mkfs.
  • Create a directory to serve as a mount point.
  • Mount and unmount a filesystem using the mount and umount commands.
  • Verify that a filesystem is mounted using lsblk and df.

This exercise maps to the following program and course learning outcomes:

  • Program Learning Outcomes (PLOs):
    • 3. Apply terminology and numeric or system concepts: You will apply the concepts of filesystems and mount points by creating and managing them directly.
  • Course Learning Outcomes (CLOs):
    • 4. Configure hardware and basic network components: Formatting and mounting are essential, everyday tasks for a Linux system administrator.

This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.

Learning Objective O*NET KSAs Technologies Used
Format a partition with a specific filesystem. Knowledge: Computers & Electronics
Skills: Installation
mkfs, ext4, exFAT
Mount and unmount a filesystem in Linux. Knowledge: Computers & Electronics
Abilities: Information Ordering
mount, umount

3 Prerequisites

This exercise requires a running Fedora 42 virtual machine and assumes you have completed Exercise 6.1. You must have the my_raw_disk.img file from that exercise.

4 Step-by-Step Guide

Open a terminal window in your Fedora VM to begin.

4.1 Step 1: Verify Your Block Device

First, ensure the virtual disk from the last exercise is still attached as a block device. If you have rebooted your VM, you will need to re-attach it.

  1. Run lsblk to see if your loop device (e.g., loop0 with partition loop0p1) is present.

  2. If it is not present, re-run the losetup command from the previous exercise with the raw disk image:

    sudo losetup -fP my_raw_disk.img

4.2 A Note on NBD Devices

Exercise 6.1 also introduced the qemu-nbd method for qcow2 files. If you were using that method, your device would be /dev/nbd0 instead of a loop device. The following commands would need to be adjusted (e.g., sudo mkfs.ext4 /dev/nbd0p1). This exercise will proceed assuming you have followed the primary path using the raw image and losetup.

4.3 Step 2: Install Filesystem Utilities

To create exFAT filesystems, you need an extra utility.

  1. Run the following command to install the exfatprogs package:

    sudo dnf install -y exfatprogs

4.4 Step 3: Format with the ext4 Filesystem

Your first task is to format your new partition with ext4, the standard Linux filesystem.

  1. Use the mkfs.ext4 command. The partition name is the loop device name with p1 appended.

    
    # Replace /dev/loop0p1 if your device name is different
    
    sudo mkfs.ext4 /dev/loop0p1

    The command will create the filesystem and report that it is done.

4.5 Step 4: Mount the Filesystem

To access the newly formatted volume, you must mount it on a directory.

  1. First, create a directory to serve as the mount point:

    
    sudo mkdir /mnt/my_new_drive
    
    sudo mount /dev/loop0p1 /mnt/my_new_drive
  2. Verify the mount was successful. Run lsblk again. You should now see your mount point (/mnt/my_new_drive) listed next to your partition.

    
    lsblk

Take a screenshot of this lsblk output and add it to your notebook.

4.6 Step 5: Unmount and Re-Format with exFAT

Now, you will practice re-formatting with a different filesystem for cross-platform compatibility.

  1. First, unmount the device using the umount command:

    
    sudo umount /mnt/my_new_drive
  2. Now, format the same partition with the exFAT filesystem:

    
    sudo mkfs.exfat /dev/loop0p1

    You will be warned that the device contains an existing filesystem. Type y and press Enter to proceed.

  3. Mount the exFAT filesystem to the same mount point:

    
    sudo mount /dev/loop0p1 /mnt/my_new_drive
  4. Verify the mount again using the df -hT command, which shows disk free space and filesystem Type.

    
    df -hT

    Look for the line for /dev/loop0p1 and confirm that the “Type” is now exfat.

Take a screenshot of the df -hT output and add it to your notebook.

5 Reflect and Review

ImportantReflection: 3-2-1

Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:

  • 3 filesystems you have learned about.
  • 2 commands used to manage mounting.
  • 1 question you still have about why different filesystems exist.
TipCheck on Learning

Answer these questions in your notebook to solidify your understanding:

  1. What does the mkfs command stand for, and what is its purpose?
  2. Before you can mount a filesystem, what must you first create?
  3. You want to format a USB drive to share files between Windows, Mac, and Linux computers. The files are very large. Would ext4 or exFAT be a better choice? Why?
  4. What command would you use to see all mounted filesystems and their types?
Back to top