[virt-tools-list] How to remove a virtual swap disk in a guest image?

Richard W.M. Jones rjones at redhat.com
Mon May 12 08:06:46 UTC 2014

On Sun, May 11, 2014 at 07:02:04PM -0500, Peng Yu wrote:
> Hi,
> The following blocks are from a guest. I have the block
> mintaka--vg-swap_1 which I want to remove (it was created when the
> guest was first made). Then I want the freed space be allocated to
> mintaka--vg-root (so that it will be expanded to 7.7GB). Does anybody
> know what I should do? (I know that this is not related to the usage
> of virsh, but I'm not sure where I should ask this question as I don't
> quite understand how /dev/mapper works) Thanks.

You can do this using guestfish actually.  Something like this:

  guestfish -a disk.img -i
  ><fs> lvremove /dev/mintaka/vg-swap_1
  ><fs> lvresize-free /dev/mintaka/vg-root 100
  ><fs> resize2fs /dev/mintaka/vg-root
  ><fs> exit


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch

More information about the virt-tools-list mailing list