How to shrink size of disk image on iscsi - lvm

Quốc Hưởng

New Member
Mar 2, 2018
16
1
1
33
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
 
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).
 
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).
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!