KB
Storage & Filesystems

Extending Non-LVM Disk Linux

5 min read904 words13 code blocks

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:

MethodRiskAvailability
growpart (recommended)Low — resizes in place, no deleteNeeds the cloud-guest-utils / cloud-utils-growpart package
fdisk delete and recreateHigh — partition is removed and rebuiltAlways 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:

bash
df -hT
lsblk
sudo fdisk -l /dev/sda

Save that output somewhere off the machine.

1. Install the tool#

bash
# Ubuntu / Debian
sudo apt install cloud-guest-utils -y

# RHEL / Rocky / AlmaLinux
sudo yum install cloud-utils-growpart -y

2. Rescan the disk#

bash
echo 1 | sudo tee /sys/class/block/sda/device/rescan
lsblk

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

bash
sudo growpart /dev/sda 1

Preview the change first if you want to be cautious:

bash
sudo growpart --dry-run /dev/sda 1

4. Grow the filesystem#

bash
# 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#

bash
echo 1 | sudo tee /sys/class/block/sda/device/rescan
sudo fdisk -l /dev/sda

2. Record the exact start sector#

bash
sudo fdisk -l /dev/sda

Write 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#

bash
sudo fdisk /dev/sda
PromptEnterNotes
CommandpPrint — confirm the layout and start sector
CommanddDelete
Partition numbere.g. 1The partition being extended
CommandnNew
Partition typepPrimary
Partition numbersame number as deletedMust match
First sectorthe recorded start sectorMust match exactly
Last sector(accept default)Uses the whole disk
CommandwWrite and exit

If fdisk offers to remove the existing filesystem signature, answer N. Answering yes destroys the filesystem.

Note: Nothing is written to disk until w. If you lose your place, press q to quit safely and start over.

4. Reboot#

The kernel cannot reread the partition table of a mounted disk, so a reboot is required here.

bash
sudo reboot

5. Grow the filesystem#

After the machine returns:

bash
# ext4
sudo resize2fs /dev/sda1

# xfs
sudo xfs_growfs /

Verification#

bash
df -hT
lsblk

The partition and mount point should both show the new size.

Check the filesystem is healthy — worth doing after any partition table change:

bash
# ext4, requires unmounting or a reboot to run on root
sudo e2fsck -n /dev/sda1

# xfs
sudo xfs_repair -n /dev/sda1

The -n flag means check only, change nothing. Reboot once more and confirm everything mounts cleanly before deleting the snapshot.

Troubleshooting#

SymptomCause 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 fdiskThe partition table was written incorrectly. Restore the snapshot.
System will not boot after Method BStart sector did not match. Restore the snapshot — this is why it is taken.
resize2fs: Bad magic number in super-blockWrong device, or the partition does not hold ext4. Check with sudo blkid /dev/sda1.
Partition is not the last one on diskIt cannot be grown in place. Add a second disk instead, or migrate to LVM.
df unchanged after resizeFilesystem 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.