How can I grow up space of the /dev/mapper/ubuntu--vg-ubuntu--lv
?
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 298M 1.2M 297M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 78G 63G 13G 84% /
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/sda2 974M 307M 600M 34% /boot
/dev/loop1 56M 56M 0 100% /snap/core18/2751
/dev/loop0 56M 56M 0 100% /snap/core18/2785
/dev/loop2 64M 64M 0 100% /snap/core20/1950
/dev/loop3 64M 64M 0 100% /snap/core20/1974
/dev/loop4 92M 92M 0 100% /snap/lxd/23991
/dev/loop5 92M 92M 0 100% /snap/lxd/24061
/dev/loop6 54M 54M 0 100% /snap/snapd/19457
/dev/loop7 54M 54M 0 100% /snap/snapd/19361
tmpfs 298M 0 298M 0% /run/user/1002
information about all available devices:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
loop0 7:0 0 55.7M 1 loop /snap/core18/2785
loop1 7:1 0 55.7M 1 loop /snap/core18/2751
loop2 7:2 0 63.5M 1 loop /snap/core20/1950
loop3 7:3 0 63.5M 1 loop /snap/core20/1974
loop4 7:4 0 91.8M 1 loop /snap/lxd/23991
loop5 7:5 0 91.9M 1 loop /snap/lxd/24061
loop6 7:6 0 53.3M 1 loop /snap/snapd/19457
loop7 7:7 0 53.3M 1 loop /snap/snapd/19361
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 29G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 79G 0 lvm /
sdb 8:16 0 120G 0 disk
└─ubuntu--vg-ubuntu--lv 253:0 0 79G 0 lvm /
sr0 11:0 1 1024M 0 rom
$ sudo growpart /dev/sdb 1
WARN: unknown label
failed [sfd_dump:1] sfdisk --unit=S --dump /dev/sdb
sfdisk: /dev/sdb: does not contain a recognized partition table
FAILED: failed to dump sfdisk info for /dev/sdb
the attributes of a logical volume before resizing
$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv 👈️
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID 5w3Tyc-6NUd-R5yk-3gj5-aPWq-73Qa-DAB0Mz
LV Write Access read/write
LV Creation host, time ubuntu-server, 2021-09-24 13:15:35 +0000
LV Status available
# open 1
LV Size 78.99 GiB 👈️
Current LE 20222
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
extend the size of a logical volume
$ sudo lvextend -L+30g /dev/ubuntu-vg/ubuntu-lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 88.99 GiB (22782 extents) to 118.99 GiB (30462 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
size of logical volume was changed
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
loop0 7:0 0 55.7M 1 loop /snap/core18/2785
loop1 7:1 0 55.7M 1 loop /snap/core18/2751
loop2 7:2 0 63.5M 1 loop /snap/core20/1950
loop3 7:3 0 63.5M 1 loop /snap/core20/1974
loop4 7:4 0 91.8M 1 loop /snap/lxd/23991
loop5 7:5 0 91.9M 1 loop /snap/lxd/24061
loop6 7:6 0 53.3M 1 loop /snap/snapd/19457
loop7 7:7 0 53.3M 1 loop /snap/snapd/19361
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 29G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 119G 0 lvm / 👈️
sdb 8:16 0 120G 0 disk 👈️
└─ubuntu--vg-ubuntu--lv 253:0 0 119G 0 lvm / 👈️
sr0 11:0 1 1024M 0 rom
resize the file systems
$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 12, new_desc_blocks = 15
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 31193088 (4k) blocks long.
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 298M 1.2M 297M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 117G 66G 47G 59% / 👈️
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/sda2 974M 307M 600M 34% /boot
/dev/loop1 56M 56M 0 100% /snap/core18/2751
/dev/loop0 56M 56M 0 100% /snap/core18/2785
/dev/loop2 64M 64M 0 100% /snap/core20/1950
/dev/loop3 64M 64M 0 100% /snap/core20/1974
/dev/loop4 92M 92M 0 100% /snap/lxd/23991
/dev/loop5 92M 92M 0 100% /snap/lxd/24061
/dev/loop6 54M 54M 0 100% /snap/snapd/19457
/dev/loop7 54M 54M 0 100% /snap/snapd/19361
tmpfs 298M 0 298M 0% /run/user/1002