How to Expand and Resize Linux Disks: Step-by-Step Partition and Mount Guide
This guide walks you through expanding a Linux disk from 500 GB to 2 TB, resizing the partition with fdisk, checking and enlarging the ext4 filesystem, remounting, and configuring persistent auto‑mount using /etc/fstab, rc.local, systemd, and autofs, while addressing common errors.
1. Disk Expansion
Linux partition commands: fdisk modifies the MBR partition table (maximum size 2 TB).
1.1 View disk vdc start cylinder
fdisk -lResult shows vdc1 start at 2048 and end at 1048575999. Record the start value.
1.2 Verify that vdc has grown from 500 GB to 2 TB and prepare to expand the vdc1 partition
1.3 Unmount the filesystem
umount /data1.4 Resize the partition with fdisk
fdisk /dev/vdcUse p to print, d to delete the existing partition (do not save or exit), then n to create a new primary partition with the original number (1). Set the start sector to the previously recorded 2048 and the end sector to the desired size (e.g., 4194303999). Finish with wq to write changes.
1.5 Check and enlarge the filesystem (ext4)
e2fsck -f /dev/vdc1 resize2fs /dev/vdc11.6 Remount the partition and verify
lsblk mount df -hAfter these steps vdc1 expands from ~453 GB to ~1.8 TB.
2. Disk Partitioning
List disks: fdisk -l Create a new partition on /dev/vdb: fdisk /dev/vdb Use n to create a primary partition (default number 1), set start sector to 2048, end sector to 4194303999, then wq to save.
Format the partition: mkfs.ext4 /dev/sdb1 Mount it: mount /dev/sdb1 /data/ Verify:
df -h3. Automatic Mount on Boot
Method 1: /etc/fstab
Add an entry to /etc/fstab so the mount persists after reboot.
Method 2: /etc/rc.local
Place the mount command in /etc/rc.local, which runs as a shell script during system startup.
Method 3: systemd mount unit
Systemd can manage mounts as services, allowing options such as waiting for network availability, automatic unmount, and skipping failed mounts.
[Unit]
Description=Mount DO Volume volume
[Mount]
What=/dev/disk/by-uuid/d946870c-ef31-48ee-a9f1-446acaa56f46
Where=/mnt/volume
Options=defaults,nofail,discard,noatime
Type=ext4
[Install]
WantedBy=multi-user.targetControl the unit with commands like:
systemctl status mnt-volume.mount
systemctl enable mnt-volume.mount
systemctl disable mnt-volume.mount
systemctl start mnt-volume.mount
systemctl stop mnt-volume.mountMethod 4: autofs
Install autofs ( yum install autofs -y) and configure it to mount filesystems on demand when accessed.
4. Common Mount Errors and Fixes
4.1 Write‑protected (read‑only) mount
Re‑format the partition (e.g., mkfs.ext4 /dev/sdb1) and remount.
4.2 Unable to read superblock
Run a filesystem check:
# Disk: /dev/vdb
fsck.ext3 -B 1024 /dev/vdbAfter fixing, remount the filesystem.
These procedures cover disk expansion, partition resizing, filesystem resizing, manual and automatic mounting, and troubleshooting typical errors.
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.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
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.
