3.1 Disk Partitioning, Modern Filesystems & Mount Options

Key Takeaways

  • With 512-byte logical sectors, the conventional MBR addressing boundary is about 2 TiB. There are four primary table entries and one can describe an extended partition.

  • GPT uses 64-bit logical block addresses and primary and backup metadata. The protective MBR signals legacy tools that the disk is in use.

  • Use growpart to extend a partition into usable space immediately after it. Verify the new block-device boundary before resizing the filesystem or LVM physical volume.

  • ext4 distinguishes data journaling, ordered data writes and writeback. XFS grows while mounted and RHEL 9 does not support shrinking it in place.

  • Use findmnt --verify --verbose to check the fstab configuration. Test the intended mount and verify its live source and options before rebooting.

Last updated: November 2026

Disk Partitioning, Modern Filesystems & Mount Options

Storage administration forms the bedrock of enterprise Linux system reliability, performance, and disaster recovery. This chapter provides a rigorous understanding of how physical and virtual storage media are partitioned, formatted with modern journaling filesystems, and consistently mounted during system initialization, as required for technical competency in the CompTIA Linux+ (XK0-006) context.


1. Disk Partition Schemes: MBR vs. GPT

A partition table divides a block device into separately addressable regions. Some Linux storage stacks use a whole device directly, for example as an LVM physical volume, so inspect the current layout before changing it.

Master Boot Record (MBR)

The traditional MBR structure occupies the first 512 bytes at logical block address (LBA) 0. Four 16-byte records store entries with 32-bit LBA start and size fields. The signature bytes at offsets 510 and 511 are 55 AA. Legacy BIOS boot code can share that sector with the table. One of the four entries can be an extended partition containing a chain of logical partitions described by extended boot records.

For a 512-byte logical sector device, the 32-bit LBA addressing boundary is about 2 TiB. The address space from zero through the last 32-bit address contains 2322^{32} sectors, so the boundary corresponds to 2,199,023,255,552 bytes. The size field itself has a maximum of one fewer sector. Check the logical sector size with lsblk -o NAME,LOG-SEC,PHY-SEC before assuming the boundary. Conventional MBR has no built-in table checksum or backup copy.

GUID Partition Table (GPT)

GPT uses 64-bit addresses. Practical capacity depends on the device, operating system and software stack. The protective MBR at LBA 0 uses partition type 0xEE to mark the disk as in use to legacy utilities. Its size field saturates on disks too large for the legacy field. The primary GPT header is at LBA 1 and the backup header is at the disk’s last LBA. Each header identifies its partition-entry array and the CRC32 values permit detection of damaged metadata. Use a matching backup to recover the table with a partition editor when needed.

FeatureMBRGPT
Address fields32-bit sector addresses and lengths64-bit logical block addresses
Entry layoutFour primary slots; one can describe an extended partitionA header records the entry count and entry size. A common layout uses 128 entries of 128 bytes.
Table recoveryKeep an external backup of partition informationPrimary and backup GPT structures with checksums
Boot considerationsCommon with legacy BIOSStandard for UEFI; BIOS systems can also use GPT with a suitable bootloader setup
Partition typesOne-byte type code, such as 0x83A partition type GUID

2. Storage Partitioning & Inspection Utilities

Linux system administrators must select the appropriate utility based on whether an environment requires interactive manipulation, non-interactive scripting, or live cloud expansion.

Interactive Partitioning: fdisk and gdisk

  • fdisk: Historically designed exclusively for MBR disks, modern versions of fdisk (from util-linux) seamlessly manage both MBR and GPT partition tables. It operates interactively:
    • p: Print the current partition table.
    • n: Create a new partition.
    • d: Delete an existing partition.
    • t: Change a partition's system type code (e.g., Linux filesystem, Linux swap, Linux LVM).
    • w: Write changes to disk and exit (commits table modifications).
    • q: Quit without saving alterations.
  • gdisk: Dedicated GPT fdisk utility. It can load a convertible MBR layout for inspection before writing GPT metadata. It also has a recovery and transformation menu (r) with operations for using backup GPT metadata. Review the proposed layout before writing.

Scriptable Partitioning: parted

GNU parted supports both MBR and GPT and is built for automation and scripting via its non-interactive mode (-s). It operates directly on partition sizes, megabytes, and percentages:

# Use a confirmed spare lab disk. Creating a label replaces existing partition metadata.
parted -s /dev/sdb mklabel gpt

# Reserve the range from 1 MiB to the 50 GiB boundary; mkpart does not format it.
parted -s /dev/sdb mkpart data ext4 1MiB 50GiB

parted /dev/sdb print
parted /dev/sdb align-check optimal 1

Technical Tip: A 1 MiB boundary is sector 2048 with 512-byte logical sectors and is aligned to 4 KiB. Use the device topology and parted align-check optimal when the device has additional alignment requirements.

Cloud and Virtual Disk Expansion: growpart

When a virtual disk expands, its partition table can retain the previous boundary. growpart from cloud-utils can extend the chosen partition to the end of the usable space or the next partition, whichever comes first. The tool can skip changes below its configured minimum-growth threshold. Use a backup or snapshot appropriate for the system and check which disk the guest actually sees.

# Inspect the proposed change to partition 1 on the lab disk
growpart -N /dev/nvme0n1 1
# Write the planned boundary after confirming the disk and layout
growpart /dev/nvme0n1 1
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS /dev/nvme0n1

Only proceed to a filesystem or LVM resize once the kernel sees the new partition size. If the running system cannot refresh the table for an in-use device, plan how to reread it during maintenance.

Block Device Discovery: lsblk and blkid

Before formatting or mounting storage, you must accurately identify device nodes and their unique identifiers:

  • lsblk: Lists all block devices in a hierarchical tree. Using lsblk -f displays the filesystem type (FSTYPE), volume label (LABEL), Universally Unique Identifier (UUID), and current mount point (MOUNTPOINTS):
    lsblk -f
    # NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
    # sda
    # ├─sda1      vfat   FAT32 BOOT   6B21-1A09                             480M     6%   /boot/efi
    # └─sda2      xfs          ROOT   d7a8e234-9012-4c6e-b34e-89a1bcdef012   42G    18%   /
    # sdb
    # └─sdb1      ext4   1.0   DATA   9e31d456-789a-bcde-f012-3456789abcde   95G     1%   /data
    
  • blkid: Reports detected attributes for a block device, such as its filesystem type and identifier. Privileged probing can read current on-disk metadata:
    blkid /dev/sdb1
    # /dev/sdb1: UUID="9e31d456-789a-bcde-f012-3456789abcde" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="a1b2c3d4-01"
    

3. Modern Linux Filesystems: ext4 vs. XFS

A filesystem organizes files and directories on its backing storage. ext4 and XFS are common examples; use the filesystem’s own tools and rules.

Fourth Extended Filesystem (ext4)

ext4 is common on Debian and Ubuntu installations. It extends ext3 with features such as extent-based block mapping:

  • Extents: Map a contiguous range of logical file blocks to a contiguous range of filesystem blocks, reducing the metadata needed for large ranges.
  • Inodes: ext4 creates inode tables for its block groups. Exhausting available inodes can prevent creating files while free data blocks remain. Compare df -h /data and df -i /data.
  • Journaling modes: data=journal journals file data and metadata. The usual data=ordered mode journals metadata and orders related data writes before the corresponding metadata commit. data=writeback journals metadata without that data-before-metadata ordering. Journaling behavior concerns filesystem recovery. A database still needs its own durability and backup controls.

XFS Filesystem

XFS is a 64-bit journaling filesystem and the default local filesystem in Red Hat Enterprise Linux (RHEL) 9.

  • Allocation Groups (AGs): XFS divides a filesystem into allocation groups that track free space and inode allocations. Independent groups allow concurrent allocation work.
  • Dynamic Inode Allocation: Unlike ext4, which allocates a fixed number of inodes during filesystem creation (leading to potential "Out of Space" errors when inodes are exhausted even if disk gigabytes remain free), XFS allocates inode storage dynamically as needed, within filesystem and allocation constraints.
  • Online Expansion (xfs_growfs): XFS filesystems can be grown while mounted and actively serving live production traffic:
    xfs_growfs /data
    
  • Smaller volumes: RHEL 9 supports XFS growth and does not support shrinking an XFS filesystem in place. To migrate to a smaller volume, create a new filesystem with enough space, restore a verified backup, and check the result before retiring the original.

Btrfs and tmpfs

Btrfs uses copy-on-write and supports snapshots of subvolumes. Checksums can detect corruption in protected data and metadata. Scrub verifies readable data and can repair a damaged copy when a verified redundant copy exists. Snapshots share unchanged data and retain older blocks as writes occur, so monitor their space and keep independent backups.

tmpfs stores files in virtual memory and can use swap unless configured otherwise. A size option limits its use. Use it for temporary working data whose contents may disappear at unmount or reboot, such as an application’s disposable runtime workspace.

4. Filesystem Creation & Maintenance

Filesystems are initialized using the mkfs frontend or filesystem-specific binaries.

# Format /dev/sdb1 with ext4, a custom label, and 1% reserved block count
mkfs.ext4 -L "BACKUP_VOL" -m 1 /dev/sdb1

# Format a verified empty lab partition with XFS
mkfs.xfs -L "APP_DATA" /dev/sdc1
UtilityCritical Command FlagsDescription
mkfs.ext4-b <1024, 2048, or 4096>Sets the filesystem block size in bytes. Defaults depend on the creation profile and device.
-L <label>Sets the ext filesystem volume label, up to 16 bytes.
-m <percent>Specifies percentage of reserved blocks for root (default 5%; reducing to 1% makes more blocks available to ordinary users).
-N <inodes>Requests an inode count in place of the default calculation.
mkfs.xfs-fForce overwrite of partition if an existing filesystem signature is detected.
-b size=<bytes>Sets logical block size (default 4096).
-L <label>Assigns volume label (up to 12 characters for XFS).
tune2fs-L <label>Changes the volume label of an existing ext filesystem.
-m <percent>Modifies the reserved block percentage dynamically without unmounting.
-o <mount_options>Configures default mount options stored permanently in the ext4 superblock.
xfs_repair-nChecks an unmounted XFS filesystem without writing repairs. A dirty log can prevent a full check.

The generic fsck dispatches to a filesystem-specific checker. The Linux ext checker is e2fsck, normally used on an unmounted filesystem. XFS performs log recovery at mount and uses xfs_repair for offline repair. df reports filesystem usage, while du measures the directory tree it can traverse. The difference matters when deleted files remain open or a filesystem reserves blocks. Use fio on dedicated test files or disposable storage to measure throughput, I/O operations per second and latency for a specified workload. Confirm whether a job writes before running it.

Linux software RAID

Linux software RAID can combine disks through an MD device. RAID 0 stripes data without redundancy. RAID 1 mirrors data so surviving copies can serve reads after a member fails. cat /proc/mdstat shows MD array state and rebuild progress, and mdadm --detail /dev/md0 reports the chosen array’s members and health. Redundancy helps availability; keep a separate backup for accidental deletion and corruption.

5. Mount Management & /etc/fstab

mount /dev/sdb1 /mnt/storage attaches an identified filesystem to a directory; umount /mnt/storage detaches it. Use findmnt /mnt/storage to inspect its active source and options. On many Linux systems /etc/mtab links to kernel-reported mount information, while /proc/mounts reflects the current process’s mount namespace. Fstab describes intended persistent configuration.

If a target is busy, use fuser -vm /mnt/storage to identify usage and stop or move the relevant process gracefully. Forced unmount is intended for some situations such as unreachable NFS. Lazy unmount detaches the mount from the namespace now and cleans up references later; it is unsuitable as a guarantee that storage has stopped receiving I/O.

The /etc/fstab File

To persist mounts across system reboots, entries are declared in /etc/fstab. Use the six standard fields in a new entry. In the underlying format, omitted final dump and check fields default to zero.

# <file system>                           <mount point>  <type>  <options>       <dump>  <pass>
UUID=9e31d456-789a-bcde-f012-3456789abcde /data          ext4    defaults,noexec 0       2
UUID=d7a8e234-9012-4c6e-b34e-89a1bcdef012 /              xfs     defaults        0       0
192.168.1.50:/exports/nfs                 /mnt/nfs       nfs     _netdev,nofail  0       0
Field PositionField NameDescription & Best Practices
1Device IdentifierPoints to block storage. Best Practice: Use UUID=... or LABEL=.... Never rely on /dev/sdX names, as kernel disk assignment ordering can change across reboots if drive controllers re-enumerate.
2Mount PointAbsolute directory path where the filesystem attaches (e.g., /data). Directory must exist.
3Filesystem TypeSpecifies the driver (ext4, xfs, vfat, btrfs, nfs, swap).
4Mount OptionsComma-delimited list of filesystem flags (no spaces allowed).
5Dump FrequencyUsed by the legacy dump backup tool. A zero value tells the legacy tool to skip the entry.
6Fsck Pass NumberConventional values are 1 for a root filesystem that needs a boot check, 2 for other checkable local filesystems, and 0 to skip it. systemd orders the root check first and may run other checks in parallel. XFS usually uses 0.

Critical Mount Options

  • defaults: Selects the filesystem and kernel defaults, usually including rw,suid,dev,exec,auto,nouser,async.
  • ro / rw: Requests a read-only or read-write mount. Use remount with the desired option to change a supported active mount, then verify it.
  • noexec, nosuid, nodev: Block direct execution from the mount, ignore set-ID privileges and file capabilities, and prevent interpreting device nodes, respectively. An interpreter can still read a script as data.
  • noatime and nodiratime: Skip access-time updates for all inodes or just directories, respectively. noatime already includes directories.
  • nofail: On systemd, makes the mount optional for the relevant boot target. The mount can still fail or complete later.
  • _netdev: Tells systemd to treat a mount as network-dependent when the filesystem type alone is insufficient, for example a filesystem on iSCSI storage. Network ordering does not guarantee a remote server is reachable.

An NFS export can be mounted from a source such as server:/exports/team with type nfs. A Samba or other SMB share uses a source such as //server/team with the Linux cifs mount helper; keep credentials out of a publicly readable entry. The autofs daemon can mount resources on access, using its configured maps. This is useful when mounting every remote share at boot would be unnecessary.

After editing fstab, inspect it with findmnt --verify --verbose. On a systemd host, run systemctl daemon-reload to regenerate unit definitions when appropriate. Test the intended mount and check its live source and options. mount -a attempts mounts for eligible entries, can affect unrelated devices, and may skip mounts already active or marked noauto; it does not simulate a reboot.

Test Your Knowledge

On a Linux host using the conventional XFS mount-time log recovery, which fstab pass number explicitly skips a boot-time check on the secondary XFS volume?

A

1, to check it before all other volumes

B

2, to schedule it after the root check

C

3, to enable parallel XFS checks

D

0, to skip the boot-time filesystem check

Test Your Knowledge

A lab VM sees an NVMe disk’s new capacity, and there is usable contiguous space after partition 1. Which command can extend the existing partition entry after checking the supported layout and dry-run result?

A

parted /dev/nvme0n1 mklabel gpt

B

growpart /dev/nvme0n1 1

C

fdisk -l /dev/nvme0n1

D

xfs_growfs /data

Test Your Knowledge

Which ext4 mount option journals both file data and metadata for a filesystem configured with a journal?

A

data=journal

B

data=ordered

C

data=writeback

D

journal=strict

Sections you finish are checked off in the contents.