Need some confirmation to resize a partition (without LVM)

Hi,

sorry, I know this is the wrong forum … anyway can somebody take my fear and confirm, please:

I want to increase a device within Linux Ubuntu 20.04 LTS.
The device is a TARGET provided from Synology NAS to a VM within Proxmox.
The target is directly linked as HDD within the VM, consequently, this is just a simple device. I do not use LVM or anything else, it is just raw. The respective device is /dev/sda, there was just one partition /dev/sda/sda1.

One can see that /dev/sda has 16 TB, partition sda1 is 10 TB, 6 TB are free. Is

sudo resize2fs -p /dev/sda1

simply enough or do I need to resize sda1 by cfdisk initially?

THX
Thorsten

Hi

To be on the safe side, you could also resize the partition by booting into SystemRescueCD and using PartEd…

All nicely with GUI…

My 2 cents
Andy

1 Like

But is the command

sudo resize2fs -p /dev/sda1

correct or do I need to increase /dev/sda1 with e.g. cfdisk before that command?

TIA

I’m not offhand sure what Ubuntu 20 uses as filesystem…
It should be correct, but I’d need to check it up.

If it’s the root file system you can only grow which I think is what you plan to do a few things first
IIRC btrfs filesystem and lvm are the only filesystem that support mounted grow and shrink I’m guessing your system uses ext4.

sudo resize2fs /dev/sda1

The command above would resize to the maximum permitted.

In your case I think your right in adding the -p (I’m assuming that switch is for persistent as it’s a technically a virtual drive)

so sudo resize2fs -p /dev/sda1 should work if we assume that your running the command directly on the ubuntu machine

sudo cfdisk /dev/sda 

command I think your referring to IIRC deletes the partition and recreates it you should be able to just run the sudo resize2fs -p /dev/sda1 cmd

I had to resize the disk by:

  1. cfdisk /dev/sda
    ->select the respective partition (here sda1)
    → increase size (see red box in the screenshot)

  2. resize2fs -p /dev/sda1

Worked well, however I sweat a lot. :slight_smile:

Oh, by the way - it was an ext4 file system. I unmounted the file system (it was just media), but it would have been possible during operation, too.

1 Like