3

My question is almost a duplicate of this question, but not quite because that one is about ext3 and I am already using LVM. I have an older HP Pavilion laptop running Fedora 11. I chose Fedora because it was semi-compatible with the hardware and it ran VMware well... but since I no longer need VMware I am looking to test out other distros and find one that's more compatible. (Specifically looking for software suspend support and maybe something more lightweight)

I'd like to try out a few new distros without hosing the existing (working) Fedora setup. Since I am using LVM, is it possible to reduce the size of my LVM LV and then install new distros into the volgroup, without the new distros destroying the Fedora setup? Here's how my LVM is set up now:

[root@token ~]# /sbin/lvm lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg_token/lv_root
  VG Name                vg_token
  LV UUID                JPCDlb-HHW7-fMDy-h8p2-Itbp-hwfK-3CwN97
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                91.96 GB
  Current LE             23542
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/vg_token/lv_swap
  VG Name                vg_token
  LV UUID                3JMF4u-3jXx-Xy6H-saNt-Aljh-6Idw-73O4IS
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

[root@token ~]# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_token-lv_root
                       91G   68G   24G  75% /

Are there distros which will allow me to install into a new logical volume without destroying the existing one? If so, which ones, and how would I go about making room for the new LV?

Josh
  • 8,449

1 Answers1

3

I don't know if that functionality is offered by typical installers, but it is easy enough to do from a live CD (or live USB or whatever). Both SystemRescueCD and GParted Live have the required tools readily available (there are undoubtedly many other suitable live distributions). Note that you need to boot from a separate system as ext3 filesystems cannot be shrunk while mounted.

You can use the GParted GUI to shrink the filesystem by up to 20GB or so, and resize the existing logical volume accordingly. Then, when you install another distribution, you will be able to create a logical volume in the free space. Note that not all distributions support installing to a logical volume (all the “serious” ones do, of course); for Ubuntu, you need the server installer (as opposed to the desktop installer with snazzy graphics but fewer options).

If you can't or don't want to use a GUI, here's an overview of how to do this on the command line:

  1. pvscan to detect physical volumes (if not already done during boot).
  2. vgimport vg_token to import the volume group (ditto).
  3. vgchange -ay vg_token to make the logical volumes accessible.
  4. resize2fs /dev/vg_token/lv_root 72G (or whatever size you decide on).
  5. lvreduce -L 72g /dev/vg_token/lv_root (this must be the same size of the filesystem; remember that with LVM tools, lowercase units are binary (k=1024) and uppercase units are decimal (K=1000)).
  6. vgchange -an vg_token; vgexport vg_token; reboot.
  • Both Debian and the Ubuntu alternate install CD have the LVM command-line tools installed, so you can use the command line approach to resize the LVM. Ubuntu also has GParted (on the standard CD as well). Both Debian and Ubuntu allow installation on an arbitrary LVM partition if you choose the "Manual partitioning" scheme. – Riccardo Murri Nov 06 '10 at 12:54
  • This worked great, thanks! I was able to install Ubuntu using the alternate CD, not the server CD. I was not able to install Peppermint into an LVM, so I shrunk the volgroup down so I could install Peppermint into a new partition /dev/sda4 and then once installed, I used rsync to move it into a logical volume. Now I have four linux distros to boot into, great for evaluating which one I'll stick with! – Josh Nov 28 '10 at 16:45