mickt
asked on
How to reduce physical volume on remote Virtual Machine?
I'd like to reduce the disk size of a remote VM as I've removed 83G logical volume that was not required. All that I've seen on this indicates the use of LiveCD, I have no physical access and can access VM console via host.
Anyone suggest a low risk method?
pvs:
PV VG Fmt Attr PSize PFree
/dev/vda2 vg_rm01 lvm2 a-- 149.51g 83.77g
vgs:
VG #PV #LV #SN Attr VSize VFree
vg_rm01 1 2 0 wz--n- 149.51g 83.77g
lvs:
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv_root vg_rm01 -wi-ao--- 50.00g
lv_swap vg_rm01 -wi-a---- 15.74g
Anyone suggest a low risk method?
pvs:
PV VG Fmt Attr PSize PFree
/dev/vda2 vg_rm01 lvm2 a-- 149.51g 83.77g
vgs:
VG #PV #LV #SN Attr VSize VFree
vg_rm01 1 2 0 wz--n- 149.51g 83.77g
lvs:
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv_root vg_rm01 -wi-ao--- 50.00g
lv_swap vg_rm01 -wi-a---- 15.74g
Can you show the following outputs:
# lvscan
# vgscan
# pvscan
# lvscan
# vgscan
# pvscan
You cannot change PV size after LVM has its hands at it.
Is it VMware, VirtualBox or another solution?
ASKER
It is kvm.
Can resize image with qemu-img resize and was hoping I could easily resize PV &VG in lvm.
Could I shutdown VM and attach disk to another VM and reduce then?
Can resize image with qemu-img resize and was hoping I could easily resize PV &VG in lvm.
Could I shutdown VM and attach disk to another VM and reduce then?
ASKER
In response to request form ganjos:
lvscan
ACTIVE '/dev/vg_rm01/lv_root' [50.00 GiB] inherit
ACTIVE '/dev/vg_rm01/lv_swap' [15.74 GiB] inherit
vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_rm01" using metadata type lvm2
pvscan
PV /dev/vda2 VG vg_rm01 lvm2 [149.51 GiB / 83.77 GiB free]
Total: 1 [149.51 GiB] / in use: 1 [149.51 GiB] / in no VG: 0 [0 ]
lvscan
ACTIVE '/dev/vg_rm01/lv_root' [50.00 GiB] inherit
ACTIVE '/dev/vg_rm01/lv_swap' [15.74 GiB] inherit
vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_rm01" using metadata type lvm2
pvscan
PV /dev/vda2 VG vg_rm01 lvm2 [149.51 GiB / 83.77 GiB free]
Total: 1 [149.51 GiB] / in use: 1 [149.51 GiB] / in no VG: 0 [0 ]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You cannot resize LVM2 MBR partition. You must add extra LVM2 MBR partition and then remove old one.
ASKER
Should be ok in my instance?
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rm01-lv_roo t
63G 7.9G 52G 14% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/vda1 485M 37M 423M 9% /boot
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rm01-lv_roo
63G 7.9G 52G 14% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/vda1 485M 37M 423M 9% /boot
ASKER
I should also have mentioned that cloud-utils-growpart RPM should be installed and linux-rootfs-resize installed. You can google the latter and may need to edit to include additional OSes as I did.
ASKER
.
Check out Andy's article and let us know if you have questions.
https://www.experts-exchange.com/Software/Virtualization/A_17461-HOW-TO-Convert-a-physical-server-or-virtual-server-P2V-V2V-to-Microsoft-Hyper-V-using-Microsoft-Virtual-Machine-Converter-3-1.html?related=28614578