Re: LVM and raid

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matt Graham
Date:  
To: Main PLUG discussion list
Subject: Re: LVM and raid
On 2015-07-21 13:28, Stephen Partington wrote:
> Ubuntu 15.04 installed and am looking to find out if there is a way
> to migrate to raid on a running system.
>
> In theory i should be able to do this by creating a degraded portion
> of the raid volume on the empty disk, extend/move my LVM to that disk
> then rebuild the original disk as part of that raid volume.


This is a softRAID-1, right? That makes the most sense for what you've
said.

> I was wondering if anyone had some documentation of information i
> could read about this scenario.


I did something like this when I moved my stuff from just 1 disk on
regular partitions to softRAID-1. First, back up all your junk, because
there are multiple points in this where you could scribble all over your
disks. Second, make sure you have a LiveCD or LiveUSB disk to boot from
if the bootloader goes wonky.
https://wiki.gentoo.org/wiki/Complete_Handbook/Software_RAID should be
pretty applicable to working with softRAID and applicable to distros
that are not Gentoo.

You'd first take the new disk and partition it. I would think you'd
need at least 2 partitions since having /boot on LVM is not going to
work, and possibly 3 because having / on LVM has more fiddly bits than
having it on a regular partition.

So, fdisk /dev/sdb , set it up with 2 or 3 partitions (whichever), and
then set up the RAID. This'll assume that your largest partition (the
one that'll be your PV) is /dev/sdb2 . You'd then do

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb2 missing

This'll set up an array in degraded mode on /dev/md0. You'd then
pvcreate /dev/md0 , then vgextend $VG_NAME /dev/md0 , then pvmove
/dev/$OLD_PV_LOCATION . Then vgreduce $VG_NAME /dev/$OLD_PV_LOCATION
and pvremove /dev/$OLD_PV_LOCATION to remove the old PV from lvm's
config. Then you'd add the old PV back to the md0 with mdadm /dev/md0
--add /dev/$OLD_PV_LOCATION . The disk sync will probably take a while.

You'll have to set things up so that the bootloader can figure
everything out. Are you going to put / on LVM? That requires that the
initrd have all the LVM tools on it. I don't know if Ubuntu can handle
that automatically or not--I would guess so, but ICBW.

--
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss