5

I would like to increase the size of my root partition. I was thinking that I could run fdisk /dev/sdb delete the sdb2 partition and create a new one that is bigger. However, I have read that I need to umount the partition ( not sure that's true ). I also saw things about resize2fs, but that is for resizing the filesystem ( I think ). What is the easiest way to increase the size to the rest of the sdb ? It'd be nice if I didn't have to boot into another partition ( as I don't have one set up ).

Current partitions and mounts:

- sdb      |  119.2G  |
  - sdb1   |   512M   |   /efi
  - sdb2   |   30G    |   /

1 Answers1

5

First off, you should consider this to be a high risk operation. You definitely want a backup in case something goes wrong.

You can increase the size of an active mounted partition (provided there is empty space at the end of the disk). You simply go into fdisk, list the partition details, then delete /dev/sdb2 and recreate it with the same starting point, same file descriptor and also ensure the boot flag is correctly toggled. Save the changes.

Once you have done this you need to reboot the system, which will hopefully reboot fine. (You need to go through this step so the OS sees the larger disk space)

All thats left is to resize the filesystem (which can be done online if its ext) To do this, just do resize2fs /dev/sdb2 (or resize4fs /dev/sdb2 depending on your distro - both commands are the same)

davidgo
  • 73,366