Resizing a Bootable Linux Partition Containing Grub
If you dual-boot Linux like I do, then the chances are that you might want to
either expand or contract your Linux partition. I had some problems when I had
my first go at it, so here’s how I expanded my partition with some notes on the
problems. The set of procedures expands a partion while preserving its data.
I expanded a Linux partion by taking space from a Windows partition.
A = Linux partition I wanted to expand
B = Partition I can take space from
X = Device identifier
Y = Partition number
I booted into a Linux with gparted through another medium, since I could not use
the partition (A) I wanted to resize. Partition A must be unmounted.
Through gparted, I unmounted the target partition and disabled the swap.
I shrunk an partition B with MiB alignment. I then had a chunk of unallocated
memory ready to be moved or used.
I expanded A by adding the unallocated memory to it and hit apply. I hit the
first roadblock here; If gparted throws an error about libparted stopping
because of overlapping partitions, redo this step with the alignment set to
At this point, the partitions have been resized, but the data for booting are in
different locations on the physical disk. GRUB could not find that data, and I
could not boot into the Linux on partition A, which is normal. I open a terminal
session to reinstall GRUB.
I commanded “sudo fdisk -l” to list and confirm the existing partitions
I commanded “sudo mount /dev/sdXY /mnt” to mount partition A to /mnt. I
got the name /dev/sdXY, the name of Partition A, from the previous step of
listing partitions .
I commanded “sudo grub-install --boot-directory=/mnt/boot /dev/sdX” to
reinstall grub onto /dev/sdX. The boot directory specifies where GRUB is to be
installed on the mounted target partition. Do not use /dev/sdXY in place of
/dev/sdX. /dev/sdX is the name of the device you are targeting .
I ran disk check on my Windows partition to make sure things were ok.