mergeraspberry-pipartitioningraspberry-pi2umount

How to merge unallocated space in Raspberry Pi?


I have a 300 GB external drive connected to a Raspberry Pi. I changed the file boot/cmdline.txt in order to use the SD card only to boot up the system. Then the partition /root is located in /dev/sda2 (external drive). How can I increase the size of the root partition? I want to merge all the unallocated space with /sda/dev2.

I tried by using GParted, but it is necessary to unmount before merging:

sudo umount /dev/sda2
umount: /: device is busy.

Gparted Image:

Gparted image


Solution

  • I used fdisk on Ubuntu to achieve something similar. Rasbian is very similar to Ubuntu and should work the same.

    You have to actually remove the original partition and the extended partition before creating a new, larger partition. It doesn't loose any data as long as you don't write changes back to the disk. Still, I would take a backup. :)

    I wrote a wiki on it here: http://headstation.com/archives/resize-ubuntu-filesystem/