Operations 8 min read

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.

Raymond Ops
Raymond Ops
Raymond Ops
How to Expand and Resize Linux Disks: Step-by-Step Partition and Mount Guide

1. Disk Expansion

Linux partition commands:

fdisk

modifies the MBR partition table (maximum size 2 TB).

1.1 View disk vdc start cylinder

fdisk -l

Result 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 /data

1.4 Resize the partition with fdisk

fdisk /dev/vdc

Use

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/vdc1

1.6 Remount the partition and verify

lsblk
mount
df -h

After 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 -h

3. 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.

<code>[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.target
</code>

Control the unit with commands like:

<code>systemctl status mnt-volume.mount
systemctl enable mnt-volume.mount
systemctl disable mnt-volume.mount
systemctl start mnt-volume.mount
systemctl stop mnt-volume.mount
</code>

Method 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:

<code># Disk: /dev/vdb
fsck.ext3 -B 1024 /dev/vdb
</code>

After fixing, remount the filesystem.

These procedures cover disk expansion, partition resizing, filesystem resizing, manual and automatic mounting, and troubleshooting typical errors.

Linuxdisk expansionFilesystemfdisksystemdauto-mountautofs
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

login 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.