Resize Disk Partition

Posted on

To resize CentOS to use full microSD card size
start by entering fdisk mode

sudo fdisk /dev/mmcblk0

command : p to print partition table

choose the Linux partition and take note of the Start sector (i.e. 2433024) then end will be the last sector on the disk size line

command : d [will delete a partition]
Partition number (1-4): [4 will delete the OS partition table]
command : n [create a new partition]
Partition Type:
Select ( default p) : p [primary partition]
First Sector : 2433024
Last Sector : 30253056

The partition type shall remain as Linux
to change the type
command : t
Partition number : 4
Hex code : 83 (linux code, l gives list of all codes)

to verify new partition table
command : p

when new partitions are correct
command : w writes new partitions

reboot pi

sudo reboot now

After rebooting check changes to partition table

sudo fdisk /dev/mmcblk0