1

I'm running ubuntu 18 cli server and I'm totally new The server provider gave me 50G more disk space but I need to add it myself. I know how to add with removing my data and configs but I want to keep all my current data and configs.

MY DF:

root@vps81785:~# df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev              493172        0    493172   0% /dev
tmpfs             100848     7884     92964   8% /run
/dev/vda1       82534960 72218004   6106508  93% /
tmpfs             504236      124    504112   1% /dev/shm
tmpfs               5120        0      5120   0% /run/lock
tmpfs             504236        0    504236   0% /sys/fs/cgroup
tmpfs             100844        0    100844   0% /run/user/0
Levi
  • 13

1 Answers1

1

Please make sure you have a backup before you the following.

You need to first increase the size of the partition, and then the size of the file system in it.

I find resizing partitions easiest with cfdisk. So it would probably be sudo cfdisk /dev/sda (but the /dev/sda could be different, look into /etc/fstab to find out your root partition device).

cfdisk should show you free space after the root partition (assuming it's /dev/sda1). Choose resize at the bottom. It will automatically propose the new maximum possible size. Write the changes and quit cfdisk.

Once that's done, best do a reboot, so that the partition table is re-read.

Then resize your filesystem. If it's the usual ext4, it's as simple as resize2fs /dev/sda1.

nagelp
  • 413
  • Thank you I've also updated the question with more details. – Levi Jan 21 '22 at 16:48
  • Ok, so with the df output now we know /dev/vda1 is your root partition. So when you do sudo cfdisk /dev/vda you should see the empty space below the /dev/vda1 partition. Please proceed as I've written in my answer above, just using 'vda' wherever I wrote 'sda'. – nagelp Jan 21 '22 at 19:29