Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a server with an existing Linux installation (CentOS 6) + boot partition on disk 1, and an empty disk 2. What we'd like to setup is this:

  • One disk (1 or 2, doesn't matter):
    • The main system in a snapshottable LVM (about 50%)
    • Backup space in an LVM (about 50%)
  • Other disk
    • /home2 and MySQL data in a snapshottable LVM (about 50%)
    • Backup space in an LVM (about 50%)
  • Either disk
    • /boot

The problem is, how can we move the main system onto an LVM without installing from scratch? The server is hosted so we don't have much influence over the OS installation process. We have:

  • Regular SSH, of course
  • A rescue mode, whereby a rescue OS is booted for us by tech support
  • No remote KVM

Our idea was:

  • In the running system, set up LVM on disk 2
  • Reboot to rescue mode and copy the main system to disk 2 (leave /boot on disk1)
  • Update grub and /etc/fstab
  • Reboot into the main system, now on disk 2
  • Wipe disk 1 and set up LVM for MySQL + /home2 on disk 1

But tips/verification on that plan are welcome.

Note: There is no important data on the server yet, though losing the configuration we already did would be a bit inconvenient.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Here's a description of a process. They used a large swap partition to host root filesystem during the change. You do not need this trick, because you have 2nd HDD.

A trick question: does your server support booting from the 2nd HDD? Can you set it up to boot from 2hd HDD? I think you could simplify the solution and not change the /boot partition. Bootloaders do not like LVM yet, so you still need a regular partition to host your /boot. Leaving /boot be and only changing the root file system location simplifies the process. You can have 2 entries in grub.conf mid-migration: with root in the old place and on LVM. In case something goes awry, you can boot to the rescue image, change the default entry and have another go at the migration.

And yes, I wholeheartedly agree with poige. Test in a virtual environment before you start playing with real system.

share|improve this answer
add comment

Some deeds are easier to accomplish then explain how to do that. :-) LVM-able initrd is the main key point I think. And you'd better verify that before trying booting. Nowadays such tests are easily done with soft like VirtualBox, for e. g..

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.