Dec 14 2021

Resize mounted partition in Linux

You can resize only last partition at runtime

 

fdisk / gdisk

  • Run sudo fdisk /dev/sda
  • press p to list the partitions. Make note of the start cylinder of /dev/sda1 ex. 2048
  • press d to delete existing partition
  • press n to create new partition it is critical that the new partition starts at the same block as the old
  • do not remove the signature
  • press a and set boot flag

Reboot or use partprobe / kpartx to see new partition’s size

Resize filesystem

sudo resize2fs /dev/sda1

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.