LVM doesn't like to share its toys
2011-Jun-30, Thursday 10:41 pmThis post is brought to you by the need to write down what I did, so I can figure out how to fix it in the morning. Follow it at your peril.
There are a few things I really dislike in the land of linux, and LVM on a single-disc laptop is high on the list. Mostly because I don't really know how to use it.
Motivation; There seems to be something very wrong with libusb on Fedora 15, but, and it hurts me to say this, it is just fine on Ubuntu 11.04. So I wanted to shrink my Fedora installation and dual-boot with Ubuntu. Sounds easy, doesn't it?
(Half-way through I remembered that I'd made a note to myself to always install Ubuntu first in these circumstances, but, well, that wasn't an option. So, into the tangled depths of LVM went I.)
gparted doesn't work with lvm, this made me sad. Figuring I had to fight fire with fire I downloaded the Fedora 15 Live CD. Boot into it,
Then go back into
Now all the data is on the left of the physical volume, and the empty space on the right. From command line;
Done. Boot back into hard-drive, everything still works, but there's a missing 50GB that's not showing up. Not in
References;
- http://www.linuxquestions.org/questions/linux-enterprise-47/shrink-lvm-without-dataloss-557746/
- http://witchbag.com/blog/2010/06/fedora-lvm-partition-windows/
- http://superuser.com/questions/217307/is-there-a-simple-way-to-move-copy-a-logical-volume-from-one-volume-group-to-anot
There are a few things I really dislike in the land of linux, and LVM on a single-disc laptop is high on the list. Mostly because I don't really know how to use it.
Motivation; There seems to be something very wrong with libusb on Fedora 15, but, and it hurts me to say this, it is just fine on Ubuntu 11.04. So I wanted to shrink my Fedora installation and dual-boot with Ubuntu. Sounds easy, doesn't it?
(Half-way through I remembered that I'd made a note to myself to always install Ubuntu first in these circumstances, but, well, that wasn't an option. So, into the tangled depths of LVM went I.)
gparted doesn't work with lvm, this made me sad. Figuring I had to fight fire with fire I downloaded the Fedora 15 Live CD. Boot into it,
yum install system-config-lvm
. Start system-config-lvm
and resize home
and root
volumes to free up space. But things are looking a bit fragmented, won't be able to shrink size of VolGroup with things like this. So, make a new lv, exact same size as root
, but contiguous with the other lvs. From command line, load up lvs and copy;lvm vgchange -a y
dd if=/dev/VolGroup/lv-root of=/dev/VolGroup/lv-root2 bs=4M
Then go back into
system-config-lvm
, rename lv-root
as lv-root-orig
, and lv-root2
as lv-root
. Then remove lv-root-orig
(and any snapshots related to it).Now all the data is on the left of the physical volume, and the empty space on the right. From command line;
lvm vgchange -a y
pvresize --setphysicalvolumesize 100G /dev/sda2
Done. Boot back into hard-drive, everything still works, but there's a missing 50GB that's not showing up. Not in
system-config-lvm
, not in disc utilities, not in gparted. Oops. The lvm aware tools say it's not in the VolGroup, don't see it at all. The lvm unaware tools say the VolGroup still takes up the entire disc. What to do? *scratches head*References;
- http://www.linuxquestions.org/questions/linux-enterprise-47/shrink-lvm-without-dataloss-557746/
- http://witchbag.com/blog/2010/06/fedora-lvm-partition-windows/
- http://superuser.com/questions/217307/is-there-a-simple-way-to-move-copy-a-logical-volume-from-one-volume-group-to-anot