Raspbian comes pre-configured to run on smaller SD cards. Thus, the default partition sizes are generally configured to not exceed 4GB. In case you want to use SD cards larger than 4GB (e.g. 32GB) you will definitely want to use the free unallocated space, right? Luckily, this can be achieved rather easily. The default Raspbian partition schema looks something like the following using a 32GB sd card:
pi@raspberrypi / $ sudo fdisk -c -l /dev/mmcblk0 Disk /dev/mmcblk0: 31.3 GB, 31322013696 bytes 4 heads, 16 sectors/track, 955872 cylinders, total 61175808 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00090806 Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 6399999 3138560 83 Linux
Although you could manually resize your partitions using fdisk Raspbian comes with a handy tool called raspi-config that will take care of this process for you:
All you need to do in order to resize your root partition is to select Expand Filesystem in the menu (see screenshot). raspi-config takes care of the rest for you, pretty neat, right? After a reboot all of your free disk space will be used:
pi@raspberrypi ~ $ df -h Filesystem Size Used Avail Use% Mounted on rootfs 29G 2.3G 26G 9% / /dev/root 29G 2.3G 26G 9% / devtmpfs 215M 0 215M 0% /dev tmpfs 44M 208K 44M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 88M 0 88M 0% /run/shm /dev/mmcblk0p1 56M 9.7M 47M 18% /boot
In case you are still interested in manually resizing your partitions you might want to have a look at e.g. Chris Newland’s post. Enjoy!