Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I ran out of space?? Resizing the SD/root partition
#1
The Raspberry is a good little unit, and one of the tasks it does for you automatically now is to resize the root partition so that you get the full size of your SD card. Sadly most other SBC's don't, and expect you to know how to do that.. But its actually not that obvious, especially if like me you are not a regular linix user.
When you create a new image on your SD it does not start off with all the SD memory free, so you have to resize, if you find your SBC is resizing (a few do) then you won't need this, but I never could get a simple answer to the issue!


Lucky I stumbled onto this blog post that helps to explain it all, you have to do this the 1st time you boot up a new SD image, if you write anything before you do that you will lose data.
Here's the original post
http://gleenders.blogspot.nl/2014/08/ban...-root.html 

As its quite old, and the blogger does not seem to post any more, it might vanish so here is the bones of it again

sudo fdisk /dev/mmcblk0
In fdisk:

Press ‘p’ to print the partition table:

Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
4 heads, 16 sectors/track, 486192 cylinders, total 31116288 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: 0x00084078

   Device Boot           Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      124927       61440   83  Linux
/dev/mmcblk0p2          124928    31116287    15495680   83  Linux 

the 124928 number may well be quite different on your SD, but take note of it, its this number that matters as its the start of the partition
Press 'd' to delete a partition:
Enter '2' to choose the second partition.
Press 'n' to create a new partition:
Enter 'p' to select primary as partition type.
Partition number: enter to accept 2 as default partition number.
First sector: enter to accept default.
This should be that 124928 number of the number you took not of as the start
Last sector: enter to accept default.
Press 'w' to write the new partition table.
Reboot to force the kernel to recognise the new partition table.

sudo reboot
After the system has come back up you still have to resize the partition.

sudo resize2fs /dev/mmcblk0p2


when done you will now have the full size of your drive available to you to store data
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply


Messages In This Thread
I ran out of space?? Resizing the SD/root partition - by Brian Beuken - 01-25-2018, 09:28 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)