Extend your partition on Raspberry PI

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
b1o
IT and IS Guru-Berserk
Posts: 198
Joined: 15 Mar 2010, 03:16

Extend your partition on Raspberry PI

Postby b1o » 20 Sep 2013, 12:22

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
CPU: i7 950 3.1 ghz |RAM: 12 GB DDR3 |Graphics: Nvidia Geforce gtx 280 |motherboard: Rampage II Extreme |OS: Arch + windows7

Just remember, there is no such thing as a stupid question, until you ask it

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Extend your partition on Raspberry PI

Postby viking60 » 20 Sep 2013, 13:11

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.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Re: Extend your partition on Raspberry PI

Postby dedanna1029 » 24 Sep 2013, 20:42

Nice! :)
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html


Return to “Tips & Tricks”