How to Expand a Linux Disk from 500GB to 2TB Without Data Loss
This guide walks you through checking the current partition layout, safely unmounting the volume, using fdisk to delete and recreate the partition with the same start sector, resizing the ext4 filesystem, remounting the disk, and configuring automatic mounts via fstab, systemd, or autofs.
Disk expansion procedure
Assume a virtual disk /dev/vdc has been enlarged from 500 GB to 2 TB and the existing partition vdc1 must be expanded to use the new space.
Identify partition start
fdisk -l /dev/vdcRecord the start sector (e.g., 2048). The same start value must be used when recreating the partition.
Unmount and delete the partition
umount /dataLaunch the partition editor without writing changes:
fdisk /dev/vdc
d # delete partition 1
# do NOT write (w) or quit (q) yetRecreate the partition with the same start
fdisk /dev/vdc
n # new primary partition
1 # partition number
2048 # start sector (same as recorded)
<em>Enter</em> # accept default end sector to use the whole disk or specify a larger last sector (e.g., 4194303999)
w # write table and exitResize the filesystem
For an ext4 filesystem:
e2fsck -f /dev/vdc1
resize2fs /dev/vdc1Remount and verify
mount /dev/vdc1 /data
lsblk
df -hGeneral partitioning commands
fdisk -l– list disks and partitions. fdisk /dev/<em>device</em> – interactive MBR partition editor (supports up to 2 TB). mkfs.ext4 /dev/<em>partition</em> – create an ext4 filesystem. mount /dev/<em>partition</em> /mountpoint – mount a filesystem. df -h – display disk usage.
Automatic mounting options
/etc/fstab
Add a line such as:
/dev/vdc1 /data ext4 defaults,nofail 0 2/etc/rc.local
Append the mount command so it runs at boot:
mount /dev/vdc1 /datasystemd mount unit
Create /etc/systemd/system/mnt-volume.mount with the following content:
[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.targetEnable and control the unit:
systemctl enable mnt-volume.mount
systemctl start mnt-volume.mount
systemctl status mnt-volume.mount
systemctl stop mnt-volume.mount
systemctl disable mnt-volume.mountautofs
Install the daemon and configure on‑demand mounting: yum install -y autofs Further configuration is outside the scope of this summary.
Troubleshooting common errors
Read‑only (write‑protected) mount
Reformat the partition and remount:
mkfs.ext4 /dev/sdb1
mount /dev/sdb1 /dataSuperblock read error
Run a low‑level filesystem check and then remount:
fsck.ext3 -B 1024 /dev/vdb
mount /dev/vdb /dataAdditional notes
The partition must be deleted and recreated with the identical start sector; data remains intact because the filesystem is not overwritten.
Stop services that use the filesystem (e.g., MySQL, Elasticsearch) before resizing to avoid corruption.
For XFS filesystems use xfs_growfs /mountpoint instead of resize2fs.
If the disk is managed by LVM, use pvresize, lvextend, and the appropriate filesystem resize tool.
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.
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.)
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.
