Operations 9 min read

Master Linux Disk Partitioning and Mounting: A Step‑by‑Step Guide

This guide explains the fundamentals of Linux disk partitioning, shows how to list devices with lsblk, walk through creating and formatting partitions using fdisk and mkfs, demonstrates temporary and permanent mounting via mount and /etc/fstab, and covers unmounting and deleting partitions with practical command examples and safety tips.

Raymond Ops
Raymond Ops
Raymond Ops
Master Linux Disk Partitioning and Mounting: A Step‑by‑Step Guide

Disk Partition Principle

Disk partitioning splits a physical hard‑disk into independent logical sections (e.g., sda1, sda2). Each partition appears as a separate block device, allowing isolated file systems, easier space management and data organization.

Viewing Disk Devices and Partitions

List all block devices with their size, type and mount point: lsblk Show filesystem type and UUID as well:

lsblk -f

Creating a New Partition with fdisk

Start an interactive session for the target disk (e.g., /dev/sdb) and follow the prompts:

Enter m for help.

Enter n to create a new partition.

Select partition type: p for primary or e for extended.

Specify the partition number (usually 1 for the first partition).

Provide the start and end sectors, or a size such as +10G.

Press w to write the table and exit.

fdisk /dev/sdb

Formatting the Partition

After the partition appears as /dev/sdb1, create a filesystem (ext4 in this example):

mkfs -t ext4 /dev/sdb1

Mounting the Partition

Temporary mount

Create a mount point and mount the partition:

mkdir /mnt/temp
mount /dev/sdb1 /mnt/temp

Verify with lsblk that the mount point is active.

Permanent mount

Add an entry to /etc/fstab so the partition is mounted automatically after reboot. Example line: /dev/sdb1 /mnt/data ext4 defaults 0 0 Apply the changes without reboot:

mount -a

Unmounting a Partition

Unmount by device name or by mount point:

umount /dev/sdb1
umount /mnt/data

If the device is busy, ensure no processes are using the mount point before retrying.

Deleting a Partition

Re‑enter fdisk for the disk, delete the desired partition, and write the changes: fdisk /dev/sdb Press d to delete.

Select the partition number (e.g., 1).

Confirm the deletion.

Press w to write the table and exit.

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.

LinuxSystem AdministrationMountfdiskDisk Partitionfstab
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

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.