Resize main partition (utilize all SD card)

It's annoying when you copy image to the SD card and the main partion uses 2Gb out of 8Gb (in my case)
Here is just a quick reminder what to do to set up arch linux on Pi while utilizing all 8Gb or whatever size SD card you have.

So you want to resize the partition to match the SD card since there is likely to be a lot of unused/unusable space by default. Log in with username root and password root (either via SSH or with a keyboard and screen connected to the Raspberry Pi, either will work). Run "fdisk /dev/mmcblk0". Type the command 'p' and press enter. You should see two lines looking similar to this:

/dev/mmcblk0p1                     1      195312           97656        c  W95 FAT32 (LBA)
/dev/mmcblk0p2            197265        15544319         7673527+  83  Linux

Those are the current partitions. What we need to do is delete the second one and recreate it larger. Make a note of the first number on the second line (in this case 197265) and then type the command 'd' (and press enter). Choose 2. Now we create a new one with 'n' and enter 'p' for primary and 2 for partition number 2. Now we get to the first sector, and here it's important that you enter the number we took note of earlier, in this case 197265. Select the largest value for last sector. Now that we've done that enter 'w' to write and then 'q' to quit. Reboot with the command 'reboot' and once you've booted and logged in again run 'resize2fs /dev/mmcblk0p2'.

Related Articles