How to Expand and Remount a Linux Disk from 500GB to 2TB Without Data Loss
This guide walks you through expanding a Linux block device from 500 GB to 2 TB, adjusting the partition table with fdisk, resizing ext4 filesystems, remounting the volume, and configuring persistent or on‑demand mounts via fstab, rc.local, systemd, and autofs.
1. Prepare and Inspect the Disk
Use fdisk -l to list current disks and note the start sector of the target partition (e.g., /dev/vdc1 starts at 2048 and ends at 1048575999). Record the start value because it must remain unchanged when recreating the partition.
2. Unmount the Filesystem
Before modifying the partition, unmount it:
umount /data3. Resize the Partition with fdisk
Launch fdisk on the disk: fdisk /dev/vdc Press p to print the current table.
Press d and select the partition number to delete it (do not save yet).
Press n to create a new primary partition, reuse the original partition number (1).
Set the start sector to the previously recorded value (e.g., 2048).
Set the last sector to the end of the disk (e.g., 4194303999) or to the desired size.
Press w to write the table and exit.
4. Check and Resize the Filesystem
For ext4 filesystems, run:
e2fsck -f /dev/vdc1 resize2fs /dev/vdc1The partition should now report the larger size (e.g., from 453 GB to ~1.8 TB).
5. Remount and Verify
Confirm the new size with:
lsblk mount df -hThe filesystem should be mounted on /data with the expanded capacity.
6. Persistent Mount Options
/etc/fstab
Add an entry to /etc/fstab so the mount survives reboots:
/dev/vdc1 /data ext4 defaults,nofail 0 0/etc/rc.local
Alternatively, place the mount command in /etc/rc.local:
mount /dev/vdc1 /data/systemd Mount Unit
Create a unit file (e.g., /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.targetManage it with standard systemd commands:
systemctl status mnt-volume.mount
systemctl enable mnt-volume.mount
systemctl start mnt-volume.mount
systemctl stop mnt-volume.mountautofs
For on‑demand mounting, install autofs: yum install autofs -y Configure /etc/auto.master and related maps to mount the device only when accessed, with automatic unmount after inactivity.
7. Common Errors and Fixes
Read‑only (write‑protected) mount
If the filesystem is mounted read‑only, reformat it (e.g., mkfs.ext4 /dev/sdb1) and remount.
Superblock cannot be read
Run a low‑level check: fsck.ext3 -B 1024 /dev/vdb Then remount the filesystem.
8. Summary of Steps
Unmount the target mount point.
Record the start sector of the existing partition.
Delete the partition with fdisk (do not save yet).
Create a new partition using the same number and start sector, extending the end sector to the desired size.
Write the changes and exit fdisk.
Run e2fsck -f and resize2fs for ext2/3/4, or xfs_growfs for XFS.
Remount the filesystem and verify with df -h.
Configure persistent or on‑demand mounts via fstab, rc.local, systemd, or autofs as needed.
These procedures apply to standard block devices; logical volume management requires a different approach.
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.
