Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How do I extend a LVM Volume inside a VM?

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
kaiserchrss
Posts: 3
Joined: 2019-12-12 12:51

How do I extend a LVM Volume inside a VM?

#1 Post by kaiserchrss »

Hi guys,

sorry if this is a stupid question but I just can't get it to work...

I'm trying to extend the disk space on my proxy server which is running inside VMWare.
I was able expand the VM-volume and add it to my VG but it always displays the same low space on the / mount point...

Here are the details from the CLI (I'm running Debian 10):

root@proxy:/home/administrator# /sbin/fdisk -l
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: Virtual disk
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: dos
Disk identifier: 0x412ed99f

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 499711 497664 243M 83 Linux
/dev/sda2 501758 83884031 83382274 39,8G 5 Extended
/dev/sda3 83884032 209715199 125831168 60G 8e Linux LVM
/dev/sda5 501760 83884031 83382272 39,8G 8e Linux LVM

Partition table entries are not in disk order.




Disk /dev/mapper/proxy--vg-root: 95,8 GiB, 102819168256 bytes, 200818688 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


Disk /dev/mapper/proxy--vg-swap_1: 4 GiB, 4294967296 bytes, 8388608 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


root@proxy:/dev/mapper# df -T
Dateisystem Typ 1K-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
udev devtmpfs 2011228 0 2011228 0% /dev
tmpfs tmpfs 405088 7608 397480 2% /run
/dev/mapper/proxy--vg-root ext4 36643428 32631856 2120452 94% /
tmpfs tmpfs 2025424 28 2025396 1% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
tmpfs tmpfs 2025424 0 2025424 0% /sys/fs/cgroup
/dev/sda1 ext2 240972 68741 159790 31% /boot
tmpfs tmpfs 405084 12 405072 1% /run/user/1000

root@proxy:/home/administrator# /sbin/vgdisplay
--- Volume group ---
VG Name proxy-vg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 11
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size <99,76 GiB
PE Size 4,00 MiB
Total PE 25538
Alloc PE / Size 25538 / <99,76 GiB
Free PE / Size 0 / 0
VG UUID 3l221s-NwGD-eFVy-u6iU-41Fp-mRfu-Y0rWkt


root@proxy:/home/administrator# /sbin/lvdisplay
--- Logical volume ---
LV Path /dev/proxy-vg/root
LV Name root
VG Name proxy-vg
LV UUID DtqA12-LvVK-Utug-dBQP-cELT-0xcq-mnkMAz
LV Write Access read/write
LV Creation host, time proxy, 2017-07-10 15:01:42 +0200
LV Status available
# open 1
LV Size <95,76 GiB
Current LE 24514
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0

--- Logical volume ---
LV Path /dev/proxy-vg/swap_1
LV Name swap_1
VG Name proxy-vg
LV UUID cooJhc-AOCn-lUsq-ry3C-imCt-dqf0-GQ0Guc
LV Write Access read/write
LV Creation host, time proxy, 2017-07-10 15:01:42 +0200
LV Status available
# open 2
LV Size 4,00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1


root@proxy:/home/administrator# sudo mount /dev/proxy-vg/root /
mount: /: /dev/mapper/proxy--vg-root already mounted on /.

---

I also have a screenshot of my gparted if that helps identifying the error:
Image

kaiserchrss
Posts: 3
Joined: 2019-12-12 12:51

Re: How do I extend a LVM Volume inside a VM?

#2 Post by kaiserchrss »

BTW. This is the Error I'm trying to get rid of:

Image

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How do I extend a LVM Volume inside a VM?

#3 Post by p.H »

I cannot see the pictures with my internet access.

Did you extend the ext4 filesystem inside the LV ?

Code: Select all

resize2fs /dev/mapper/proxy--vg-root

kaiserchrss
Posts: 3
Joined: 2019-12-12 12:51

Re: How do I extend a LVM Volume inside a VM?

#4 Post by kaiserchrss »

p.H wrote:I cannot see the pictures with my internet access.

Did you extend the ext4 filesystem inside the LV ?

Code: Select all

resize2fs /dev/mapper/proxy--vg-root
Wow. this was exactly, what I needed.

Now it's working perfectly!

root@proxy:/home/administrator# /sbin/resize2fs /dev/mapper/proxy--vg-root
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/proxy--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 5, new_desc_blocks = 12
The filesystem on /dev/mapper/proxy--vg-root is now 25102336 (4k) blocks long.

Status: Filesystem / OK - 37.59% used (35.34 of 94.01 GB), trend: +1.53 GB / 24 hours

Thank you very much!! :D

gerip03
Posts: 1
Joined: 2020-01-22 03:17

Re: How do I extend a LVM Volume inside a VM?

#5 Post by gerip03 »

kaiserchrss wrote:Hi guys,

sorry if this is a stupid question but I just can't get it to work...

I'm trying to extend the disk space on my proxy server which is running inside VMWare.
I was able expand the VM-volume and add it to my VG but it always displays the same low space on the / mount point...

Here are the details from the CLI (I'm running Debian 10):

root@proxy:/home/administrator# /sbin/fdisk -l
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: Virtual disk
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: dos
Disk identifier: 0x412ed99f

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 499711 497664 243M 83 Linux
/dev/sda2 501758 83884031 83382274 39,8G 5 Extended
/dev/sda3 83884032 209715199 125831168 60G 8e Linux LVM
/dev/sda5 501760 83884031 83382272 39,8G 8e Linux LVM

Partition table entries are not in disk order.




Disk /dev/mapper/proxy--vg-root: 95,8 GiB, 102819168256 bytes, 200818688 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


Disk /dev/mapper/proxy--vg-swap_1: 4 GiB, 4294967296 bytes, 8388608 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


root@proxy:/dev/mapper# df -T
Dateisystem Typ 1K-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
udev devtmpfs 2011228 0 2011228 0% /dev
tmpfs tmpfs 405088 7608 397480 2% /run
/dev/mapper/proxy--vg-root ext4 36643428 32631856 2120452 94% /
tmpfs tmpfs 2025424 28 2025396 1% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
tmpfs tmpfs 2025424 0 2025424 0% /sys/fs/cgroup
/dev/sda1 ext2 240972 68741 159790 31% /boot
tmpfs tmpfs 405084 12 405072 1% /run/user/1000

root@proxy:/home/administrator# /sbin/vgdisplay
--- Volume group ---
VG Name proxy-vg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 11
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size <99,76 GiB
PE Size 4,00 MiB
Total PE 25538
Alloc PE / Size 25538 / <99,76 GiB
Free PE / Size 0 / 0
VG UUID 3l221s-NwGD-eFVy-u6iU-41Fp-mRfu-Y0rWkt


root@proxy:/home/administrator# /sbin/lvdisplay
--- Logical volume ---
LV Path /dev/proxy-vg/root
LV Name root
VG Name proxy-vg
LV UUID DtqA12-LvVK-Utug-dBQP-cELT-0xcq-mnkMAz
LV Write Access read/write
LV Creation host, time proxy, 2017-07-10 15:01:42 +0200
LV Status available
# open 1
LV Size <95,76 GiB
Current LE 24514
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0

--- Logical volume ---
LV Path /dev/proxy-vg/swap_1
LV Name swap_1
VG Name proxy-vg
LV UUID cooJhc-AOCn-lUsq-ry3C-imCt-dqf0-GQ0Guc
LV Write Access read/write
LV Creation host, time proxy, 2017-07-10 15:01:42 +0200
LV Status available
# open 2
LV Size 4,00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1


root@proxy:/home/administrator# sudo mount /dev/proxy-vg/root /
mount: /: /dev/mapper/proxy--vg-root already mounted on /.

---

I also have a screenshot of my gparted if that helps identifying the error:
Image
kaiserchrss wrote:
p.H wrote:I cannot see the pictures with my internet access.

Did you extend the ext4 filesystem inside the LV ?

Code: Select all

resize2fs /dev/mapper/proxy--vg-root
Wow. this was exactly, what I needed.

Now it's working perfectly!

root@proxy:/home/administrator# /sbin/resize2fs /dev/mapper/proxy--vg-root
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/proxy--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 5, new_desc_blocks = 12
The filesystem on /dev/mapper/proxy--vg-root is now 25102336 (4k) blocks long.

Status: Filesystem / OK - 37.59% used (35.34 of 94.01 GB), trend: +1.53 GB / 24 hours

Thank you very much!! :D
Was facing same issue. Thank you so so so much. It is working for me too

Post Reply