Extending Non-LVM Disk Linux
At a glance#
- Purpose: Grow a standard partition and its filesystem on a disk that does not use LVM.
- Applies to: Linux VMs with plain partitions — typically cloud images and older builds.
- Risk: High — the traditional method deletes and recreates a live partition.
- Time: About 30 minutes.
Overview#
Without LVM there is no pool to draw from, so the partition itself has to be enlarged in place. The extra space must be immediately after the partition on disk, which means only the last partition can normally be grown.
There are two methods:
| Method | Risk | Availability |
|---|---|---|
growpart (recommended) | Low — resizes in place, no delete | Needs the cloud-guest-utils / cloud-utils-growpart package |
fdisk delete and recreate | High — partition is removed and rebuilt | Always available |
Use growpart wherever you can. The fdisk method is documented below because it is sometimes the only option, but it is genuinely dangerous and should not be the default choice.
Warning: Take a VM snapshot or full backup before either method. If the partition is recreated with a different start sector, all data on it becomes unreachable.
Before you start#
- A VM snapshot or verified backup.
- Root access, and console access as a fallback.
- The disk already enlarged at the hypervisor.
Record the current layout — you will need the exact start sector if anything goes wrong:
df -hT
lsblk
sudo fdisk -l /dev/sdaSave that output somewhere off the machine.
Procedure — Method A: growpart (recommended)#
1. Install the tool#
# Ubuntu / Debian
sudo apt install cloud-guest-utils -y
# RHEL / Rocky / AlmaLinux
sudo yum install cloud-utils-growpart -y2. Rescan the disk#
echo 1 | sudo tee /sys/class/block/sda/device/rescan
lsblkThe disk should now report the larger size.
3. Grow the partition#
Note the space between the device and the partition number — this is the syntax growpart expects:
sudo growpart /dev/sda 1Preview the change first if you want to be cautious:
sudo growpart --dry-run /dev/sda 14. Grow the filesystem#
# ext4
sudo resize2fs /dev/sda1
# xfs — takes the mount point
sudo xfs_growfs /Both run online. Skip to Verification.
Procedure — Method B: fdisk delete and recreate#
Only use this when growpart is unavailable.
Warning: This deletes the partition entry. The data is not erased, but it becomes unreachable unless the new partition begins at exactly the same start sector. Record that sector before you begin and check it as you go.
1. Rescan the disk#
echo 1 | sudo tee /sys/class/block/sda/device/rescan
sudo fdisk -l /dev/sda2. Record the exact start sector#
sudo fdisk -l /dev/sdaWrite down the Start value for the partition you are extending. This number is the whole procedure — if the recreated partition starts anywhere else, the filesystem is lost.
3. Delete and recreate the partition#
sudo fdisk /dev/sda| Prompt | Enter | Notes |
|---|---|---|
Command | p | Print — confirm the layout and start sector |
Command | d | Delete |
Partition number | e.g. 1 | The partition being extended |
Command | n | New |
Partition type | p | Primary |
Partition number | same number as deleted | Must match |
First sector | the recorded start sector | Must match exactly |
Last sector | (accept default) | Uses the whole disk |
Command | w | Write and exit |
If fdisk offers to remove the existing filesystem signature, answer N. Answering yes destroys the filesystem.
Note: Nothing is written to disk untilw. If you lose your place, pressqto quit safely and start over.
4. Reboot#
The kernel cannot reread the partition table of a mounted disk, so a reboot is required here.
sudo reboot5. Grow the filesystem#
After the machine returns:
# ext4
sudo resize2fs /dev/sda1
# xfs
sudo xfs_growfs /Verification#
df -hT
lsblkThe partition and mount point should both show the new size.
Check the filesystem is healthy — worth doing after any partition table change:
# ext4, requires unmounting or a reboot to run on root
sudo e2fsck -n /dev/sda1
# xfs
sudo xfs_repair -n /dev/sda1The -n flag means check only, change nothing. Reboot once more and confirm everything mounts cleanly before deleting the snapshot.
Troubleshooting#
| Symptom | Cause and fix |
|---|---|
growpart: NOCHANGE: partition is size ... | No unallocated space follows the partition. Confirm the disk was actually enlarged and rescanned. |
unable to open /dev/sda1: No such file or directory after fdisk | The partition table was written incorrectly. Restore the snapshot. |
| System will not boot after Method B | Start sector did not match. Restore the snapshot — this is why it is taken. |
resize2fs: Bad magic number in super-block | Wrong device, or the partition does not hold ext4. Check with sudo blkid /dev/sda1. |
| Partition is not the last one on disk | It cannot be grown in place. Add a second disk instead, or migrate to LVM. |
df unchanged after resize | Filesystem step was skipped or run against the wrong device. |
Recommendation: If this server is likely to need space again, convert it to LVM at the next rebuild. Extending an LVM volume is a routine online operation with none of the risk above — see Creating new LVM Partition Linux.