How to shrink size of disk image on iscsi - lvm

Discussion in 'Proxmox VE: Installation and configuration' started by Quốc Hưởng, Apr 19, 2019.

  1. Quốc Hưởng

    Quốc Hưởng New Member

    Joined:
    Mar 2, 2018
    Messages:
    16
    Likes Received:
    0
    I have this situation:
    upload_2019-4-19_16-13-41.png
    Iscsi-volume-group is created on Iscsi target.

    Now i want to decrease hard disk to 100GB, How can i do this?
    This is my config:


    upload_2019-4-19_16-14-27.png

    Thanks for your help
     
  2. NdK73

    NdK73 Member

    Joined:
    Jul 19, 2012
    Messages:
    69
    Likes Received:
    3
    You have to work from both command lines (guest and host), and any error can destroy all your data.
    First, from the guest, you have to resize filesystem and partitions (possibly using gparted) to the final size of the disk (better play safe and have a good margin... in your case reduce to 80G or so).
    Once done, you can use lvreduce to change the LV size . Remember to update the VM config file.
    And finally, again from the guest, you can extend the partition (and the fs) to fill the new drive.

    Quite a pain, right?
    Well, another solution, not involving command line, is possible: create a new 100GB drive for the VM. mount it in the guest, copy the data from old disk, update the config and remove old disk. But it requires 100GB free on "some" accessible storage (local, NFS, SMB, iSCSI).
     
  3. Quốc Hưởng

    Quốc Hưởng New Member

    Joined:
    Mar 2, 2018
    Messages:
    16
    Likes Received:
    0
    So i will have 2 disks in your solutions?
    I just want to reduce the size of disk (200G to 100G) :p sorry for the mismatch
     
  4. NdK73

    NdK73 Member

    Joined:
    Jul 19, 2012
    Messages:
    69
    Likes Received:
    3
    Temporarily you'll have 2 disks. Once done, you remove the 200GB one and you're left with just the 100GB one.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice