Created attachment 410288 [details] verbose output of guestfish Description of problem: guestfish sub command 'lvresize' does not work when shrinking a logical volumn on my fedora 12, while extending works fine. Version-Release number of selected component (if applicable): $ cat /etc/redhat-release Fedora release 12 (Constantine) $ uname -a Linux localhost 2.6.32.9-70.fc12.x86_64 #1 SMP Wed Mar 3 04:40:41 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux $ qemu-kvm -version QEMU PC emulator version 0.11.0 (qemu-kvm-0.11.0), Copyright (c) 2003-2008 Fabrice Bellard $ guestfish version major: 1 minor: 3 release: 8 extra: How reproducible: always Steps to Reproduce: 1. I use qemu-img to create a raw image file. $ qemu-img create tmp.img 10G Formatting 'tmp.img', fmt=raw size=10737418240 2. launch guestfish adding the image, and perform the following operations. $ guestfish -a tmp.img ><fs> run ><fs> part-disk /dev/vda mbr ><fs> pvcreate /dev/vda1 ><fs> vgcreate vg1 /dev/vda1 ><fs> lvcreate lv1 vg1 8000 ><fs> lvs-full [0] = { lv_name: lv1 lv_uuid: mzxBJ9Ef1HwR1ODOwBStVezIdPZOC02c lv_attr: -wi-a- lv_major: -1 lv_minor: -1 lv_kernel_major: 253 lv_kernel_minor: 0 lv_size: 8388608000 seg_count: 1 origin: snap_percent: copy_percent: move_pv: lv_tags: mirror_log: modules: } ><fs> lvresize /dev/vg1/lv1 6000 libguestfs: error: lvresize: File descriptor 3 (socket:[7977]) leaked on lvm invocation. Parent PID 1: guestfsd WARNING: Reducing active logical volume to 5.86 GB THIS MAY DESTROY YOUR DATA (filesystem etc.) Command failed with status code 5. ><fs> lvs-full [0] = { lv_name: lv1 lv_uuid: mzxBJ9Ef1HwR1ODOwBStVezIdPZOC02c lv_attr: -wi-a- lv_major: -1 lv_minor: -1 lv_kernel_major: 253 lv_kernel_minor: 0 lv_size: 8388608000 seg_count: 1 origin: snap_percent: copy_percent: move_pv: lv_tags: mirror_log: modules: } Actual results: lvresize returns with an error, and the volumn size is not changed. Expected results: The logical volumn lv1 should be succesffully resized. Additional info: extending a volumn works fine, with the lvm built in the example: ... ><fs> lvs-full [0] = { lv_name: lv1 lv_uuid: 9ym65Hy2LH0qJMf7kLZR6MxyqWu08IfM lv_attr: -wi-a- lv_major: -1 lv_minor: -1 lv_kernel_major: 253 lv_kernel_minor: 0 lv_size: 8388608000 seg_count: 1 origin: snap_percent: copy_percent: move_pv: lv_tags: mirror_log: modules: } ><fs> lvresize /dev/vg1/lv1 9000 ><fs> lvs_full [0] = { lv_name: lv1 lv_uuid: LbQWclvXlvj4yY3G3155MicHdt4ASEY5 lv_attr: -wi-a- lv_major: -1 lv_minor: -1 lv_kernel_major: 253 lv_kernel_minor: 0 lv_size: 9437184000 seg_count: 1 origin: snap_percent: copy_percent: move_pv: lv_tags: mirror_log: modules: }
Created attachment 410289 [details] output of libguestfs-test-tool
The lvresize command line tool asks the user for an confirmation input [y/n] when the user is trying to reduce the size of a logical volumn. However, it seems that guestfish does not feed anything to the lvresize's input, which breaks the input pipe of the command. I thinks this may be where the problem is.
Yes, there are several related bugs with reducing the size of objects. See also bug 585221 bug 585222 bug 585223.
This change fixes the lvresize problem for me: http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=c24de46d06cc3ecccf00bfaaffb06172659cdd0a
also works for me :)