Operations 38 min read

Master Linux Disk Management: Partition, Format, and Mount Like a Pro

This guide walks you through Linux disk management fundamentals, covering how to partition disks with fdisk and gdisk, create filesystems using mkfs, format partitions, mount and unmount devices, configure automatic mounts via /etc/fstab, and handle special cases such as ISO and Windows share mounts.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Disk Management: Partition, Format, and Mount Like a Pro

Introduction

Disk management is a core skill for Linux administrators. Proper partitioning, formatting, and mounting ensure efficient use of storage and reliable data access.

1. Basic Concepts

Partitioning divides a physical disk into logical sections called partitions. Devices appear under /dev (e.g., /dev/sda, /dev/sda1). For disks smaller than 2 TiB you can use MBR; larger disks require GPT.

2. Partitioning Tools

fdisk (MBR)

Install:

sudo apt-get -y install fdisk   # Ubuntu
sudo yum -y install fdisk       # CentOS

Basic commands: fdisk -l – list disks and partitions fdisk /dev/sdb – start interactive session d – delete a partition n – create a new partition w – write changes

Example: create a 2 GiB primary partition on /dev/sdc:

fdisk /dev/sdc
n
p
1
2048
+2G
w

gdisk (GPT)

Install:

sudo apt-get -y install gdisk   # Ubuntu
sudo yum -y install gdisk       # CentOS

Key commands: b – backup GPT data n – add a partition w – write table q – quit without saving

Example: add a 1 GiB partition on /dev/sdf:

gdisk /dev/sdf
n
1
2048
+1G
w

3. Formatting Filesystems

After partitioning, create a filesystem with mkfs. Common commands: mkfs -t ext4 /dev/sdx1 List supported types:

mkfs [tab][tab]
# shows ext2 ext3 ext4, vfat, ntfs, etc.

Example creating an ext3 filesystem with a label:

mkfs.ext3 -L demoTest /dev/vdb1

4. Inspecting Filesystems

Useful commands: blkid /dev/sdx1 – show UUID and label tune2fs -l /dev/sdx1 – detailed ext* info dumpe2fs /dev/sdx1 – low‑level superblock data

5. Mounting Devices

Mount a filesystem to an empty directory:

mkdir /mnt/mydisk
mount -t ext4 /dev/vdb1 /mnt/mydisk

Common mount options (comma‑separated after -o): ro / rw – read‑only / read‑write noatime – don’t update access time sync – synchronous writes

Example read‑only mount with logging:

mount -vrt ext2 -o sync,noatime /dev/vdb1 /mnt/game

Verify with df -h or mount -l. To unmount:

umount /mnt/game

6. Automatic Mounts via /etc/fstab

Add entries to /etc/fstab to mount at boot. Format:

<device|UUID|LABEL>  <mountpoint>  <fstype>  <options>  <dump>  <pass>

Example:

/dev/vdb1    /mnt/game    ext2    auto,ro    0    0
LABEL=shebeiB    /mnt/videos    ext3    auto,rw    0    0
UUID=a14f72f0-d450-473a-aaa2-4f2b811b0500  /mnt/music  ext4  noauto,rw  0  0

After editing, run mount -a to apply.

7. Special Mount Cases

ISO Images

mount -vo loop /path/to/image.iso /mnt/iso

Windows Shares (CIFS/SMB)

mount -t cifs -o username=USER,password=PASS //192.168.0.144/images /mnt/windows_share

Conclusion

By mastering partitioning tools (fdisk, gdisk), filesystem creation (mkfs), inspection utilities (blkid, tune2fs, dumpe2fs), and mounting procedures (manual, fstab, special devices), you can confidently manage Linux storage for a wide range of scenarios.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxPartitioningformattingdisk-managementMounting
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.