2

I have a multi-boot, multi-drive system that I want to transfer onto 2 bigger drives.

Currently pc has 2x1TB drives with Fedora 19 running, using RAID0 drive mirroring, with LVM2 on top of the md. I want to transfer the entire md/lvm set of filesystems to a new pair of 2TB drives configured in the same raid0/lvm2 arrangement. In addition to Fedora, there are Windows 7 partitions, and other misc partitions to copy.

To make matters harder, the Fedora root filesystem exists in the md/lvm2 partition, so I need to bring up all this infrastructure. /boot is in a real primary partition.

So I'm able to install the 2 new drives at the same time the old drives are still installed, so it is basically a big copy task, but the details are the tricky part.

Using a GParted Live boot disk, I can go in and configure the new drives in a new raid0 and lvm2 vg called "pool2". The original vg is called "pool". I partition & mount up the new filesystems and tar/copy all the files from old to new. But now the two hard parts are biting me.

  1. Getting grub2 to install/boot the new copy of the Fedora partition.
  2. Getting Windows to boot on its new copy.

Actually never to go trying #2, so for #1, Here's details of what I tried, and where I got stuck.

After the copy, I disconnect the old drives and change new drives to sda and sdb. Booting back again with the boot iso, Then I have to manually start the raid0 with the commands:

mdadm -E --scan
mdadm -A /dev/md0

No errors, /proc/mdstat shows the raid active with RAID0.

Then I have to manually start the vg with:

vgchange -a y pool2

Now to reinstall grub2 on the new partitions:

mount /dev/mapper/pool2-root /mnt/fedora
mount /dev/sda1 /mnt/fedora/boot

cd /mnt/fedora
mount -o bind /dev dev
mount -o bind /proc proc
mount -o bind /sys sys
mount -t tmpfs tmpfs tmp
chroot /mnt/fedora
grub2-install /dev/sda

Everything appears to go fine. But when I try to reboot from the new disk drives, I either get nothing as if grub2 isn't found, or I get the grub menu and it then fails during the boot very early, because it can't find the root filesystem.

What I think is happening is all the grub.cfg file is still full of the old references such as:

root=/dev/mapper/pool-root
rd.lvm.lv=pool/root
and probably UUIDs wrong.

(remember the new drives are on pool2). I also suspect maybe the initrd settings are incorrect for the new locations.

Manually changing these values in grub.cfg don't seem to help, so how can I get this working? I think I'm really close, but having to do a lot of manual md/lvm2/grub2 commands I'm no expert in, and am missing something.

  • Using labels is more robust than UUIDs. On Debian I'd tell you to run update-grub, but I'm not sure if Fedora uses the same mechanism. You can run grub-mkconfig to generate a new grub.cfg. – Gilles Mar 30 '14 at 0:54
1

First, raid0 is striping, mirroring is raid1. With raid0 if one drive fails you loose everything.

You don't want to make a new volume group. You want to partition the new disks leaving room for /boot and a partition for the raid, then use mdadm --create to create a new raid out of partitions on the new disks. Then you use pvcreate to initialize the new raid array for use with lvm, and vgextend to add the new raid array to the existing volume group, and pvmove to migrate everything off of the old array, and then use vgreduce to remove the old array from the volume group. Finally, you will want to copy your /boot partition to the new disks and reinstall grub on them with grub-install.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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