-2

The following is the current status of my disk:

NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0                       7:0    0   62M  1 loop /snap/core20/1587
loop1                       7:1    0   62M  1 loop /snap/core20/1611
loop2                       7:2    0 79.9M  1 loop /snap/lxd/22923
loop3                       7:3    0  103M  1 loop /snap/lxd/23541
loop4                       7:4    0   47M  1 loop /snap/snapd/16292
sda                         8:0    0   60G  0 disk 
├─sda1                      8:1    0    1M  0 part 
├─sda2                      8:2    0    2G  0 part /boot
├─sda3                      8:3    0   28G  0 part 
│ └─ubuntu--vg-ubuntu--lv 253:0    0   28G  0 lvm  /
├─sda4                      8:4    0   30G  0 part 
└─sda5                      8:5    0 1007K  0 part 
sr0                        11:0    1  1.4G  0 rom

I added sda4 as above, is there any way to increase the root capacity to sda4?

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
Joker
  • 47
  • 7

1 Answers1

0

You can extend the VG and LV by commands:

pvcreate /dev/sda4
vgextend ubuntu--vg /dev/sda4
lvextend -L+4GB /dev/mapper/ubuntu--vg-ubuntu--lv

The last command add 4 GB space to /
and then extend your filesystem. It it's ext4 use command:

resize2fs /

If its XFS you can use command

xfs_growfs -d /

Both resize commands can be done on the fly (w/o unmount the filesystem)

Romeo Ninov
  • 6,538
  • 1
  • 22
  • 31