

- #COMMAND LINE IMAGE RESIZE MAC INSTALL#
- #COMMAND LINE IMAGE RESIZE MAC FULL#
- #COMMAND LINE IMAGE RESIZE MAC FREE#
You can also create new partitions and format existing ones.

Right-click the partions to unmount them and then right-click to resize or move the partition. This is the layout of the default debian image on a 8gb sdcard. The picture below is in Dutch, but don't let that spoil the fun. You can't do this on the actual Pi, because to resize partitions they need to be unmounted.
#COMMAND LINE IMAGE RESIZE MAC INSTALL#
There is of course an easy fix for this: apt-get install gparted. I think it's installed by default on a Ubuntu LiveCD but not on an installed system. If you are not very comfortable working on the command line, like in Steve Robillards excellent answer, there are some GUI applications available.
#COMMAND LINE IMAGE RESIZE MAC FREE#
I now leave about 1GB free to make absolutely sure that my images can be switched between SD cards without issue. This came to a head when I switched a couple of RPis from v1 to the new v2 model, which uses Micro SD cards. Doing so caused a bunch of problems when switching to a new card which (even though it was stated as 16GB) was about 200MB smaller than the older card. I'm coming back to this answer with a note of caution: I have been using a bunch of 16GB SD cards, and I got caught out by maxxing my partition to fill the card I was using. Selecting this will cause your root partition to be resized to fill the card the next time you boot your RPi. The second option on the blue dialog that follows is titled expand_rootfs, with the description "Expand root partition to fill SD card". (I think you can re-run the tool manually at any time). If you're over SSH you can run it manually using $ sudo raspi-config.

This runs on first boot if you're connected directly to the RPi. Using the Debian-Wheezy Beta image, there is a configuration utility built in that makes this easy: You then resize (which is safe to run on a mounted disk) the file system to use all the space in the new root partition.

As a result you don't erase the existing data from the root partition.īy removing the swap partition you allow the root partition room to grow beyond its current size and fill the unused portion of the disk (because of the placement of the partitions -the root partition is sandwiched between the boot and swap partitions - it can't simply be resized leaving the swap partition alone). The real magic here is that you delete the root and swap partitions, then recreate only the root partition (using the original start sector) before writing the data to the disk.
#COMMAND LINE IMAGE RESIZE MAC FULL#
You can now verify that the system is using the full capacity of the SD Card by entering the following command: df -h Once it is done reboot the system with the following command: sudo reboot Note: this can take a long time (depending on the card size and speed) be patient and let it finish so you do not mess up the file system and have to start from scratch. Once the system has reboot and you are back at the commandline enter the following command: sudo resize2fs /dev/mmcblk0p2 Next reboot the system with the following command: sudo reboot Type w to save the changes you have made. Next you will be prompted for the last sector you can just hit enter to accept the default which will utilize the remaining disk space. You will now be prompted for the first sector for the new partition.Įnter the start number from the earlier step (the Linux partition) Next enter 2 when prompted for a partition number. This new partition needs to be a primary partition so type p. Then type d again and then type 3 to delete the swap partition. In the case above you want to delete both the Linux and Linux swap partitions. You will then be prompted for the number of the partition you want to delete. though it will likely still be on the screen (just in case). Make a note of the start number for partiton 2, you will need this later. if you look in the last column labeled System you should have resize the new boot root partition to utilize the full partition size.įirst make a backup of your SD Card using the instructions found here in case something goes wrong.įrom the command line or a terminal window enter the following sudo fdisk /dev/mmcblk0.Make sure to reuse the same start sector as the original root partition. Recreate the main partition to utilize the remaining disk space (excluding the boot partiton).Remove the main and swap partitions (leaving the boot partition alone).
