lvdisplay showing wrong size after increasing size of VM disk

Zululander

New Member
Joined
Apr 24, 2024
Messages
17
Reaction score
5
Credits
137
Using XenOrchestra I increase the size of my VM disk from 48GB to 120GB
1715205183454.png


However when I run lvdisplay I still get 48GB
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID E0suyX-Rs9R-xxxx-xxxx-xxxx-p7LO-8orcQf
LV Write Access read/write
LV Creation host, time ubuntu-server, 2024-02-28 03:53:00 +0000
LV Status available
# open 1
LV Size <48.00 GiB
Current LE 12287
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

What might I be doing wrong?

df -h gives
Filesystem Size Used Avail Use% Mounted on
tmpfs 792M 1.2M 791M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 48G 12G 33G 27% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/xvda2 2.0G 252M 1.6G 14% /boot
overlay 48G 12G 33G 27% /var/lib/docker/overlay2/8a23a8db32d79ceb46b1a9b18b33f66d3d57f5e59xxxxxxxxxxxxxxxxxxxx/merged
overlay 48G 12G 33G 27% /var/lib/docker/overlay2/9d57e6f2a4939381e0c36ad647643404af4b02e7e9xxxxxxxxxxxxxxxxxxxx/merged
overlay 48G 12G 33G 27% /var/lib/docker/overlay2/c345795ad049e9e1338f9c6bea7c5dc6f7339a6051xxxxxxxxxxxxxxxxxxxx/merged
overlay 48G 12G 33G 27% /var/lib/docker/overlay2/4b71ebeeea8533154a31236f8626d8734db11e618xxxxxxxxxxxxxxxxxxxx/merged
overlay 48G 12G 33G 27% /var/lib/docker/overlay2/2bdf373fb3ec80f8b3608a12eff25845d91fcd2715cxxxxxxxxxxxxxxxxxxxx/merged
tmpfs 792M 4.0K 792M 1% /run/user/1000
 


Using XenOrchestra I increase the size of my VM disk
You've resized virtual disk size but that operation likely did not resize filesystem.
See if your XenOrchestra program offers options to resize filesystem.

Otherwise the command which is used to resize ext2,3,4 filesystem is called resize2fs
make sure to run man resize2fs to see how it works.
the filesystem needs to be unmounted prior to running the command.
 
Apparently I should be able to simply stop the VM and then change the setting in XenOrchestra (which I think is what I did last time when it did work).

This time however this has not worked. I am digging around to see if I can find a command to run from the command line to sort it out.
 
Apparently I should be able to simply stop the VM and then change the setting in XenOrchestra (which I think is what I did last time when it did work).

This time however this has not worked. I am digging around to see if I can find a command to run from the command line to sort it out.
Because I don't know your exact setup please use the following procedure at your own risk (ex. make a backup first):

First, if target filesystem called /dev/mapper/ubuntu--vg-ubuntu--lv you want to extend is root filesystem, then bring target system offline and access virtual disk in offline mode.

Or otherwise if the target filesystem is not root partition then dismount filesystem called /dev/mapper/ubuntu--vg-ubuntu--lv with:
sudo umount /dev/mapper/ubuntu--vg-ubuntu--lv

When done with the above run these commands:

Bash:
# Rescan the available physical partitions
sudo vgscan --mknodes

# Make the logical volumes known to the kernel
sudo vgchange -ay

# Lists all available LVM partitions
sudo lvdisplay

# Run a file system check on target partition to prevent data loss
sudo e2fsck -f /dev/mapper/ubuntu--vg-ubuntu--lv

# Extend the file system to use all available space within the logical volume
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

# Stop LVM to ensure all the changes are saved properly
sudo vgchange -an

After these steps are done you proceed with either of these steps:

1.) if it was root partition, boot system up.
2.) if it was not root partition and you unmounted it, then simply mount the partition with:
sudo mount /dev/mapper/ubuntu--vg-ubuntu--lv
 
@CaffeineAddict thanks for this.

It is not the boot partition

Bash:
sysadmin@services-dmz-2:~$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sr0                        11:0    1 1024M  0 rom
xvda                      202:0    0  120G  0 disk
├─xvda1                   202:1    0    1M  0 part
├─xvda2                   202:2    0    2G  0 part /boot
└─xvda3                   202:3    0   48G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0   48G  0 lvm  /

But all my docker containers are running on it so when I try unmount, I get told that the target is busy.

Is there a quick way to get it to an idle state?
 
It is not the boot partition
I was talking about root not boot partition. if it's root, and according to your code it is then the only way to do it is from live USB.

Also note if your disk is encrypted them my steps won't work, the procedure is different for encrypted LVM's.
 
Thanks for that. I booted off GParted, resize and then ran
Bash:
 sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
 sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

All is worked well.

Thanks your your assistance.
 
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
You can use the -r option the extend without having to also run the resize2fs command. So in your case this would have worked as well.
Code:
 sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv -r
 
Last edited:

Members online


Top