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.
To re-size partitions i followed steps from http://raspberrypi.stackexchange.com/questions/499/how-can-i-resize-my-root-partition.
sudo fdisk /dev/mmcblk0and you will see list of partions
- Delete root partition – type
dto delete a partition. Enter partition number 2
- Create new partition – type
nto create a partition. Enter
pto 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
wto save changes
- Resize partition
sudo resize2fs /dev/mmcblk0p2