How to resize / enlarge / grow a non-LVM ext4 partition

This page indicates the way to do that is unmount, delete, recreate the partition with the desired size, and use resize2fs to extend the partition. The resize2fs man page agrees.

I know 'delete the partition' sounds scary, but it doesn't change the data at all. It just changes the thing that references the container. As long as you DON'T mkfs.ext4 you should be fine.

Your partition start point needs to be the same as it was or the OS won't know how to interpret what's behind it. The end point can then be further along to make a larger partition.

I think the error in the comment is related to moving the start point. You need to start it at the exact same point as it was started. The end point can move around.

Credit to psusi for suggesting fdisk instead of cfdisk and confirming the start point issue.


An example:

/dev/sdb2 is the /boot partition. It is 100 MB, which is rather small. To increase this ext4 partition on a running system do (as root, or sudo):

umount /boot

parted /dev/sdb

(parted) print

Model: ATA Patriot Torqx 2 (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 12.9GB 12.9GB primary type=83
2 12.9GB 13.0GB 107MB primary ext4 type=83

(parted) rm 2

(parted) mkpart

Partition type? primary/extended? primary
File system type? [ext2]?
Start? 12.9GB
End? 13.4GB

(parted) quit

resize2fs /dev/sdb2

resize2fs 1.42.6 (21-Sep-2012)
Filesystem at /dev/sdb2 is mounted on /boot; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sdb2 is now 498688 blocks long.

done!

All data remains in place. /boot is ready for use and 472MB big (parted is not that secure with the sizes, read the manual to know why)

All data was backed up before, but only as a precaution. I recommend to do the same.

Use the following command to find the process which is stopping the unmounting of /boot if it fails:

lsof /boot

Good luck!