I often need this… originally from tomahhunt on the Arch Linux forums
The following commands resize the main partition of a new Arch Linux installation on a Raspberry Pi to fit the full disk.
Switch to root (sudo or su)
fdisk /dev/mmcblk0
Delete the second partition /dev/mmcblk0p2:
d >Â 2
Create a new primary partition and use default sizes prompted. This will then create a partition that fills the disk:
n >Â p >Â 2 >Â enter >enter
Save and exit fdisk:
w
Now reboot. Once rebooted:
resize2fs /dev/mmcblk0p2
Done!