0

for context I'm using ubuntu 22.04 VM over ESXI.

Currently I have my root almost completely full

administrator@alfalab:/$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           790M  2,0M  788M   1% /run
/dev/sda3        39G   35G  1,8G  96% /
tmpfs           3,9G  1,1M  3,9G   1% /dev/shm
tmpfs           5,0M     0  5,0M   0% /run/lock
/dev/sda2       512M  6,1M  506M   2% /boot/efi
tmpfs           790M  108K  790M   1% /run/user/1000

And I have one unmounted disk with 100G

administrator@alfalab:/$ sudo lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0     4K  1 loop /snap/bare/5
loop1    7:1    0  63,4M  1 loop /snap/core20/1974
loop2    7:2    0  63,5M  1 loop /snap/core20/2015
loop3    7:3    0  73,9M  1 loop /snap/core22/858
loop4    7:4    0  73,9M  1 loop /snap/core22/864
loop5    7:5    0 349,7M  1 loop /snap/gnome-3-38-2004/140
loop6    7:6    0 236,9M  1 loop /snap/firefox/3131
loop7    7:7    0 236,8M  1 loop /snap/firefox/3068
loop8    7:8    0 349,7M  1 loop /snap/gnome-3-38-2004/143
loop9    7:9    0  91,7M  1 loop /snap/gtk-common-themes/1535
loop10   7:10   0  45,9M  1 loop /snap/snap-store/638
loop11   7:11   0  40,8M  1 loop /snap/snapd/19993
loop12   7:12   0   452K  1 loop /snap/snapd-desktop-integration/83
loop13   7:13   0  12,3M  1 loop /snap/snap-store/959
loop14   7:14   0 485,5M  1 loop /snap/gnome-42-2204/126
loop16   7:16   0  40,8M  1 loop /snap/snapd/20092
loop17   7:17   0   304K  1 loop /snap/snapd-desktop-integration/49
loop18   7:18   0 496,9M  1 loop /snap/gnome-42-2204/132
sda      8:0    0    40G  0 disk
├─sda1   8:1    0     1M  0 part
├─sda2   8:2    0   513M  0 part /boot/efi
└─sda3   8:3    0  39,5G  0 part /var/snap/firefox/common/host-hunspell
                                 /
sdb      8:16   0   100G  0 disk
sr0     11:0    1  1024M  0 rom

Is there a way to expand or add this disk to the root space without breaking the VM? I have tried some approaches but they fail at some point. Is there any safe approach without having to create another VM?

  • 1
    Don't. Fix the issue of your root needing more than 20Gb. Use the extra disk to create personal space. Far better fix in the long run If you use / for personal files: set this new disk up as a mountpoint and move your files over to this disk – Rinzwind Sep 26 '23 at 13:30
  • ... and it could be something like this https://askubuntu.com/a/1235357 ... Or even a bit more complex like this https://askubuntu.com/a/1222054 – Raffa Sep 26 '23 at 13:38

1 Answers1

0

No, you can't join disk space from two separate disks into a single filesystem without using LVM (it is possible with LVM, but you set up your filesystems without it).

You can, however, move your entire root filesystem to the new disk. You have to create a partition there, format it, and then tar your entire root filesystem (while the system being inactive, so you need to boot the VM from an ISO image of an installation media) and un-tar it to the new partition. Some adjustments are also needed (especially in the /etc/fstab file). This is a bit complicated process.

As this is a VM on ESXi, I think it is best to get rid of your second unmounted disk and use that space to expand your first disk. Then you can just increase your root partition using GParted after booting the VM from installation media ISO.

raj
  • 10,353
  • Thanks for the answer. Although, since I don't manage the vCenter, i was trying fix this without having to request anything to the ESXI cluster admins. – Pedro Agostinho Sep 26 '23 at 12:19