Page 1 of 1

Extend your partition on Raspberry PI

Posted: 20 Sep 2013, 12:22
by b1o
Hi guys, this is a small tutorial on how to extend your partition size on the raspberry PI. It will work on a PC as well, but as you have no configuration options on the PI this is the primary focus here.

Step one: open fdsik with the following command:

Code: Select all

fdisk /dev/mmcblk0


Once it is open, write p and hit enter to check your partition table. on Arch ARM there will be 3 partitions there; 1,2 and 5.
Take notice of the start sectors and write them down: you will need them later on.

now execute the following:

Code: Select all

d
5
d
2


in other words first delete partition 5 then 2.

now we need to recreate the partitions with the same starting sectors. if you have followed the guide, the correct start sectors will be recommended to you.

write n to make a new partition. this should be an extended partition that goes from the start sector of the previous partition 2
make this partition go to the last sector on the disk to utilize the full SD card.

write n again to make the logical partition. this should be number 5 and start at the same start sector as the previous partition 5.
make this one also go to the last sector on the disk.

write w to save and close

reboot the PI and write:

Code: Select all

resize2fs /dev/mmcblk0p5


now your raspberry root partition will use the entire SD card.
with a little brain you can utilize this on any PC installation with linux aswell, just make sure you use the same start sector of your partitions so that you don't overwrite anything

Re: Extend your partition on Raspberry PI

Posted: 20 Sep 2013, 13:11
by viking60
ImageGreat! Arch ARM is underestimated as an ARM OS - everybody is doing the Debian tutorial so this is a good approach. +1

fdisk is a little wizard - I have not used it much but this extenstion stuff seems to work just fine. :s

I have my swapfile up and running too:
viewtopic.php?f=25&t=1763#p16976

I innitially had some trouble activating it because I was standing in /home instead of in /
But adding a swapfile (which you will need on a raspberry pi) later on, works just fine with Arch ARM.

And it makes a lot of sense since your tutorial extends the entire SD card - so it will be easier (and safer) to simply make a swapfile than making a separate swap partition.

Re: Extend your partition on Raspberry PI

Posted: 24 Sep 2013, 20:42
by dedanna1029
Nice! :)