[TriLUG] How to migrate LVM to LVM on Raid-1

Rick DeNatale rick.denatale at gmail.com
Thu Feb 16 13:26:31 EST 2006


Having just recovered from a failed SCSI hard drive, I'd now like to
put my second SCSI drive to work mirroring the first.

I've always had good backups of my user and config data, but it was
still a pain to get my machine back on it's feet.

When I replaced the drive, I re-installed Ubuntu 5.10 on /dev/sda using LVM.

The installer setup two partitions, one for /boot and another for an
LVM PV, and one VG with two LVs, one for /root and one for swap.

I'd now like to jack that up and install MDM software raid under it. 
The Ubuntu kernel seems to be built with support for mdadm raid.  I've
looked at a few how-tos but my head is still swimming and I'm, as
always leery of doing low-level drive operations.  I've also backed up
/dev/sda using g4linux.

One page I've been studying is:
http://www.debian-administration.org/articles/238

It looks like the trick is to duplicate the partitioning of /dev/sda
on /dev/sdb after changing partition types to Linux raid autodetect,
and then do some mdmadmin magic to create a raid "device".  I'm a
little nervous though when he starts making file systems on the raid
device, since I want to preserve the existing LVM setup and
filesystems on /dev/sda

If I'm reading some of the things I've found correctly, I might not
want to put the /boot partition in a raid cluster since grub seems to
have problems with that.  If that's the case I guess I can manually
back it up as needed when new kernels get installed, perhaps using
rsync, yes?

I'm looking for some advice/encouragement

Here's my current setup. Note that there are also two large IDE
drives, one of these has partitions for /home and a shared user data
partition called /public, the other is used to store generational
backups using an rsync scheme based on Jason and Jeremy's backup talk
a few years back.

$ sudo sfdisk -l

Disk /dev/hdc: 19457 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/hdc1          0+   1245    1246-  10008463+  83  Linux
/dev/hdc2       1246   19456   18211  146279857+  83  Linux
/dev/hdc3          0       -       0          0    0  Empty
/dev/hdc4          0       -       0          0    0  Empty

Disk /dev/hdd: 19457 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/hdd1          0+      1       2-     16033+  83  Linux
/dev/hdd2          2    4982    4981   40009882+  83  Linux
/dev/hdd3       4983    9963    4981   40009882+  83  Linux
/dev/hdd4          0       -       0          0    0  Empty

Disk /dev/sda: 1106 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+     30      31-    248976   83  Linux
/dev/sda2         31    1105    1075    8634937+   5  Extended
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
/dev/sda5         31+   1105    1075-   8634906   8e  Linux LVM

Disk /dev/sdb: 1115 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0       -       0          0    0  Empty
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty


Note that /dev/sdb is currently unused

$ mount
/dev/mapper/Ubuntu-root on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
/dev/hdd3 on /home type ext3 (rw)
/dev/hdd2 on /public type ext3 (rw)
/dev/hdc2 on /root/snapshot type ext3 (rw)
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
nfsd on /proc/fs/nfsd type nfsd (rw)

$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               Ubuntu
  PV Size               8.23 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              2108
  Free PE               0
  Allocated PE          2108
  PV UUID               v0S4TQ-YGh6-h1I9-nlq2-r53b-Eh04-ESjBTI

$ sudo vgdisplay
  --- Volume group ---
  VG Name               Ubuntu
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               8.23 GB
  PE Size               4.00 MB
  Total PE              2108
  Alloc PE / Size       2108 / 8.23 GB
  Free  PE / Size       0 / 0
  VG UUID               h4Xd2k-wH06-KjGJ-tKRo-oWp4-uk1T-q8pOMg

$ sudo lvdisplay
  --- Logical volume ---
  LV Name                /dev/Ubuntu/root
  VG Name                Ubuntu
  LV UUID                iP9OI1-Qkw4-kbla-fwmg-ipnP-g80A-VAFxQD
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                7.86 GB
  Current LE             2013
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:0

  --- Logical volume ---
  LV Name                /dev/Ubuntu/swap_1
  VG Name                Ubuntu
  LV UUID                nudA40-pnMa-pjWv-0Flr-bIPM-dmcb-Q7KwXp
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                380.00 MB
  Current LE             95
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:1

--
Rick DeNatale

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/



More information about the TriLUG mailing list