A
A
Andrew2022-03-05 10:37:02
LVM
Andrew, 2022-03-05 10:37:02

How to increase the size of an LVM volume?

Hello. We have a 200GB sda hard drive (of which 100 Gb is free). A 100gb LVM volume is created on the disk on which UBUNTU is installed. Need to add free space to LVM volume
fdisk -l

GPT PMBR size mismatch (209715199 != 419430399) will be corrected by w(rite).
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 79419920-93DA-4859-881E-F406FEEB6ADB

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 209713151 207611904 99G Linux filesystem

Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 99 GiB, 106296246272 bytes, 207
Units of sectors 1 * 6098 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[email protected]:~# pvscan
PV /dev/sda3 VG ubuntu-vg lvm2 [ <99.00 GiB / 0 free]
Total: 1 [<99.00 GiB] / in use: 1 [<99.00 GiB] / in no VG: 0 [0 ]

[email protected]:~# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name ubuntu-vg
PV Size <99.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25343
Free PE 0
Allocated PE 25343
PV UUID 4dQ6oT-1eL6-QfHY-urpd-CLn8-MkB3-J4j8kc

[email protected]:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 99G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 99G 0 lvm /
doing
[email protected]:~# pvresize /dev/sda3
Physical volume "/dev/sda3" changed
1 physical volume(s) resized / 0 physical volume(s) not resized

[email protected]:~# pvdisplay
--- Physical volume -- -
PV Name /dev/sda3
VG Name ubuntu-vg
PV Size <99.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25343
Free PE 0
Allocated PE 25343
PV UUID 4dQ6oT-1eL6-QfHY-urpd -CLn8-MkB3-J4j8kc

[email protected]:~# pvscan
PV /dev/sda3 VG ubuntu-vg lvm2 [<99.00 GiB / 0 free]
Total: 1 [<99.00 GiB] / in use: 1 [<99.00 GiB] / in no VG: 0 [0 ]
As you can see, the size has not increased, tell me what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2022-03-05
@dr753

Instead of expanding an existing physical volume, you need to create a new one, add it to the volume group on top of which the logical volume to be expanded is created, and after that it will be possible to increase the size of the logical volume and the file system on it.
https://shurshun.ru/linux-rasshirenie-lvm-na-letu/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question