0

Installing Arch Linux on an Existing LVM Partition

I had someone email me saying they were having a hard time installing Arch Linux over an existing installation because they wanted to maintain their /home partition, which happened to be created as an LVM.

First this document isn’t the whole installation process, but only the bits which are required for using LVM support (let it be a new LVM or to install over an existing installation that used LVM). For this instance I will leave out the pvcreate, vgcreate and lvcreate since I’m again installing against an already existing LVM partition to preserve data on a certain LVM partition from an existing installation.

For the full installation tutorial please feel free to use my previous installation blog entry

The first thing we’ll do after we log into our Arch Linux Live CD is to enable LVM support, by enabling the dm-mod module. For this we’ll do

modprobe dm-mod

Now lets run a few things to learn more about our setup. Just for the fun of it you can run pvcscan and vgscan so you can understand that you do have a Physical Volume and Virtual Group setup (without them you wouldn’t have a Logical Volume). It is important however to run lvscan, so you can understand that the volumes currently are not set to active and if you tried to do the partitioning via the arch installation at this point, you’d be over writing your data as your partitions are not seen as valid.

To activate them you’ll run

vgchange -ay
. You can check out some examples below:

Now during the partitioning portion of the installation you’ll want to go to the 3rd option of: “Manually Configure Block Devices …”

Now you’ll be able to see all your existing Logical Volumes, along with your physical partitions (including PV’s so make sure you know which are PV’s which can be gathered using fdisk -l). You can press CTRL+ALT+F2 to get to another console window (tty) and log in as root and run fdisk -l. To get back to the console screen with the installation press CTRL+ALT+F1

Here’s an example of the fdisk -l output. As you can see the systems with type 8e are formated for use with physical volumes.

Now you can setup all your partitions as you wish. The ones that are physical volumes should not be over written. Also the partition(s) that you wanted to keep also should not be overwritten (or in Arch installation verbage _recreated_). Here are some screen shots of the choices you’d use to preserve the logical volume, and choose to mount it.




Now when you get to the end of the installation you’ll be asked to configure some files.. This is VERY IMPORTANT THAT YOU DO THIS OR YOUR INSTALLATION (if / is on an LVM) will be NOT BOOT.

First you can use nano to modify /etc/rc.conf and change USELVM=”no” to USELVM=”yes” since the intent of this whole document is to use Arch Linux with LVM’s right?
Before

After

Exit with ^X (for those of you who don’t know, this is CTRL+X). Then choose Y to save it, and overwrite the original location by pressing enter.

Next we’ll use nano to modify /etc/mkinitcpio.conf (again VERY VERY IMPORTANT THAT THIS IS DONE).
We need to add lvm2 into the HOOKS line which is closer to the bottom.
Here’s a before

And After

Now you can finish the installation as you would and reboot .. and all will be golden.

You can follow my other blog entries for installing Xorg and KDE for Arch Linux

Note: I’m not responsible for any data lost that’s all on you.


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

About the Author

I am ben kevan.. Well yeah. .that's about it.

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.