Master Linux Disk Partitioning: Mount, Expand, and Resize in Three Scenarios
This guide walks you through three practical Linux disk‑partitioning scenarios—mounting a new disk to a directory, expanding a subdirectory via a symbolic link, and enlarging the root partition on an MBR disk—complete with step‑by‑step commands, formatting tips, and verification checks.
Linux Disk Partitioning: Three Scenarios
Scenario 1: Mount an existing (or newly added) disk to a new directory.
1. View disk information:
lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 32G 0 disk
├─sdb1 8:17 0 200M 0 part /boot/eif2. Create a new partition sdb2 using fdisk:
fdisk /dev/sdb
n # new partition
p # primary
2 # partition number
<Enter> # accept default start sector
+15G # size of sdb2
w # write changes3. Format the new partition (example with ext4): mkfs.ext4 /dev/sdb2 # use mkfs.xfs for XFS 4. Mount the partition:
mkdir /mnt/sdb2
mount /dev/sdb2 /mnt/sdb25. Verify the mount:
df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb2 ext4 15G 41M 14G 1% /mnt/sdb2Scenario 2: Expand a subdirectory of an existing directory using a symbolic link. (Details omitted for brevity; the method involves creating a larger logical volume or partition, formatting it, mounting it elsewhere, and linking it to the target subdirectory.)
Scenario 3: Expand the root (/) partition on a MBR disk (sda7) with XFS.
1. Check the partition table and filesystem type:
fdisk -l /dev/sda
# ... shows /dev/sda7 as the last partition
blkid /dev/sda7
/dev/sda7: UUID="f7c7645e-5d67-43f8-ba7e-5c9f019d980a" TYPE="xfs"2. Refresh the kernel partition table and grow the XFS filesystem:
sudo partprobe /dev/sda
sudo xfs_growfs /dev/sda73. Verify the new size:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda7 152G 66M 152G 1% /Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
