When you overgrow your RaspberryPi sd card - How to clone SD card and re-size root partition
After Raspberry PI arrived and you spent few weeks experimenting you start realizing that you run out of space in your sd card. Especially it is true when you use some sd card which was laying around and you was happy to save 10$. Now you constantly getting out of space messages trying to install some new package.
How to move RaspberryPi to bigger SD card ?
Cloning SD card
- Shut down Pi ansd remove original sd card
- Download and install Win32DiskImager from http://sourceforge.net/projects/win32diskimager/
- Insert existing original SD card to card reader
- Run Win32Disk Manager and specify from which disk to clone and to what image file to save. Click “Read”
- Remove original SD card to card reader
- Insert new SD card to card reader and click “Write”.Confirm that to you want to continue.
Resizing partition
To re-size partitions i followed steps from http://raspberrypi.stackexchange.com/questions/499/how-can-i-resize-my-root-partition.
- Type
sudo fdisk /dev/mmcblk0
and you will see list of partions - Delete root partition – type
d
to delete a partition. Enter partition number 2 - Create new partition – type
n
to create a partition. Enterp
to define it as primary .Specify partition number: 2 - You will be prompted to specify start number of partition. select default value which should be equal to value from original list printed in first step
- Type
w
to save changes - Reboot
sudo reboot
- Resize partition
sudo resize2fs /dev/mmcblk0p2