Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Increase the size kvm vm with lvm?

  1. #11
    Join Date
    Oct 2004
    Beans
    359
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Increase the size kvm vm with lvm?

    HA!!!!

    It worked.

    Now I do have another slight situation. I have successfully booted into the webserv vm:

    This is what I have now:
    Code:
    root@webserv:/home/admin# lsblk
    NAME                   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sr0                     11:0    1 1024M  0 rom  
    vda                    252:0    0  119G  0 disk 
    └─vda1                 252:1    0  119G  0 part 
      ├─webserv--vg-root   253:0    0   98G  0 lvm  /
      └─webserv--vg-swap_1 253:1    0  980M  0 lvm  [SWAP]
    
    root@webserv:/home/admin# lvextend -l 100%FREE -r /dev/webserv-vg/root
      New size given (5120 extents) not larger than existing size (25098 extents)
    
    root@webserv:/home/admin#
    Is there another way to maximize the /root folder?

    Regards

  2. #12
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,343

    Re: Increase the size kvm vm with lvm?

    HA!!!! It worked. Is there another way to maximize the /root folder?
    None that I'm familiar with or have used other than lvextend. There are various ways to express the size of course. Note that on the lvextend man page, lower case -l is shown as abbreviation for --extents and upper case -L is abbreviation for --size. I usually use --extents as the option. See the lvextend man page for all the variations on --size or --extents. .

  3. #13
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,343

    Re: Increase the size kvm vm with lvm?

    Based on your information in post #10, your partition is resized, but the pv with webserv-vg isn't. So there is unaccessable space. Based on a look at it's man page and this web page, you can expand the vg with pvresize and recover that space:

    Code:
    sudo pvresize /dev/sda1
    Then you can extend the root logical volume with lvextend.

    A quote from linked page where a physical disk partition was enlarged on an LVM system:
    After the reboot we use the pvresize command to fill out the extra space. As fair as I can tell, this resizes the amount of space that a LVM volume group can use on a partition and needs to be run if you resize its partition.
    This extra step with pvresize is a consequence of using LVM in the VM. I've only been using standard partitions in my personal VMs*.

    *I did once set up a VM with LVM as a trial, but found it took much longer to boot (maybe twice as long) so I abandoned that idea.
    Last edited by Dennis N; 2 Weeks Ago at 05:20 PM.

  4. #14
    Join Date
    Oct 2004
    Beans
    359
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Increase the size kvm vm with lvm?

    Hi Dennis N.

    Cannot thank you enough for helping me with this, I really appreciate it. The information from post 10 has now changed since you showed me how to use those 3 steps
    The host KVM server now looks like this:
    Code:
    root@serv:/var/vmstorage# virt-filesystems -l -h --all -a webserv
    Name                   Type       VFS  Label MBR Size Parent
    /dev/webserv-vg/root   filesystem ext4 -     -   98G  -
    /dev/webserv-vg/swap_1 filesystem swap -     -   980M -
    /dev/webserv-vg/root   lv         -    -     -   98G  /dev/webserv-vg
    /dev/webserv-vg/swap_1 lv         -    -     -   980M /dev/webserv-vg
    /dev/webserv-vg        vg         -    -     -   119G /dev/sda1
    /dev/sda1              pv         -    -     -   119G -
    /dev/sda1              partition  -    -     8e  119G /dev/sda
    /dev/sda               device     -    -     -   119G -
    root@serv:/var/vmstorage#
    I reread the lvetend --help over again and I figured out the proper arguments for within the guest vm:
    Code:
    root@webserv:/home/admin# lvextend -l +100%FREE -r /dev/webserv-vg/root
      Size of logical volume webserv-vg/root changed from <98.04 GiB (25098 extents) to <118.04 GiB (30218 extents).
      Logical volume webserv-vg/root successfully resized.
    resize2fs 1.44.1 (24-Mar-2018)
    Filesystem at /dev/mapper/webserv--vg-root is mounted on /; on-line resizing required
    old_desc_blocks = 13, new_desc_blocks = 15
    The filesystem on /dev/mapper/webserv--vg-root is now 30943232 (4k) blocks long.
    
    root@webserv:/home/admin# lsblk
    NAME                   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sr0                     11:0    1 1024M  0 rom  
    vda                    252:0    0  119G  0 disk 
    └─vda1                 252:1    0  119G  0 part 
      ├─webserv--vg-root   253:0    0  118G  0 lvm  /
      └─webserv--vg-swap_1 253:1    0  980M  0 lvm  [SWAP]
    root@webserv:/home/admin#
    So all is good now, THANK YOU!! Dennis N. For all your assistance again. I owe you one

  5. #15
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,343

    Re: Increase the size kvm vm with lvm?

    I'm glad to see you have it fixed. Question: Was the command given in post #13 necessary?

  6. #16
    Join Date
    Oct 2004
    Beans
    359
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Increase the size kvm vm with lvm?

    Quote Originally Posted by Dennis N View Post
    I'm glad to see you have it fixed. Question: Was the command given in post #13 necessary?
    I didn't use that command.

    After the 3 step commands, I went into the vm itself and resized there

    Regards

  7. #17
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,343

    Re: Increase the size kvm vm with lvm?

    Quote Originally Posted by Heeter View Post
    I didn't use that command. After the 3 step commands, I went into the vm itself and resized there...
    Great. This is good to know.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •