On Thu, Feb 16, 2006 at 04:23:45PM -0500, Rick DeNatale wrote: > > .... > > Okay, let me see if I understand by working through that article I > referenced before: > http://www.debian-administration.org/articles/238 > > I obviously still have a few blanks to fill in. Any help is appreciated. > > I'm starting with these partitions on /dev/sda > $ sudo sfdisk -l /dev/sda > > Device Boot Start End #cyls #blocks Id System > /dev/sda1 * 0+ 30 31- 248976 83 Linux > /dev/sda5 31+ 1105 1075- 8634906 8e Linux LVM > > I'm going to copy /dev/sda1 (the boot partition) to /dev/sdb1 and > make /dev/sda5 part of a raid1 md array with /dev/sdb5.
Ultimately. > 1. I need to change the partition type of /dev/sda5 from 8e to fd > "Linux raid auto" I can't seem to figure out how to do this with > sfdisk, so I guess I'll do that interactively with fdisk. NO, NO, NO. At least, not yet. This is the last step -- or one of the last steps. Doing this destroys your existing LVM partition. ( or at least has that effect. You haven't actually overwritten anything, but.... ) > 2. Now Partition /dev/sdb like /dev/sda > $sfdisk -d /dev/sda | sfdisk /dev/sdb Correct. > 3. Now create the raid array > $mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb5 Correct. I might put the "missing" last, but it really doesn't matter. > We're now going to duplicate the LVM setup which is > $ sudo pvdisplay > --- Physical volume --- > PV Name /dev/sda5 > VG Name Ubuntu > $ sudo lvdisplay > --- Logical volume --- > LV Name /dev/Ubuntu/root > VG Name Ubuntu > > --- Logical volume --- > LV Name /dev/Ubuntu/swap_1 > VG Name Ubuntu > > 4. Now create a PV on the raid array > $pvcreate /dev/md0 > > QUESTION: Do I need to worry about the uuid of this PV vis a vis > the existing PV on /dev/sda5? No, it will assign a unique one. > 5. Now create a VG > $vgcreate Ubuntu /dev/md0 > QUESTIONS: Same question about uuid, plus is it a problem having > two VGs with the same name on different devices? Note that the > original PV, VG, and LVs are still in use. I ( was going to say think, actually ) know that you will have problems ( read -- it won't let you ) creating duplicate but different VGs in the same system. The only possibility would be to make it ignore the existing name, but that would then invalidate your entire system so.... What you want to do is use a _new_ name in this command and all of the others that are dealing with the new device. "Ubuntu" isn't magic. > 6 Create the LVs > $lvcreate -l 2013 Ubuntu -n root > $lvcreate -l 95 Ubuntu -n swap_1 > > QUESTIONS: Are there any other parameters I need here? are the > short names root and swap_1 ok or do I need e.g. /dev/Ubuntu/root? The short names are what are expected. The LV name is "root". The VG name is "Ubuntu." I tend to express these in megabytes ( or some other unit ) rather than extents. That's just me. > 7. Format the LVs > > 8. Mount the new root LV > $sudo mkdir /mnt/root > $sudo mount /dev/Ubuntu/root /mnt/root > QUESTION: Is it correct that this is the first point I need to > mount anything? Up until now, you haven't had anything to mount. > 9. Copy the root partition > $cp -dpRx / /mnt/root > It doesn't seem to make sense to copy the swap partitition Absolutely correct. > 10. Mount the boot partition and copy it. True. > 11. Edit /mnt/root/etc/fstab to use the md device. > > HERE'S A PLACE WHERE I'M STUMPED. > Here are the lines in the current /etc/fstab for mounting / and swap > > /dev/mapper/Ubuntu-root / ext3 > defaults,errors=remount-ro 0 1 > /dev/mapper/Ubuntu-swap_1 none swap sw 0 0 > > What if any changes do I need to make here? Is there some LVM > config to substitute? Only the name that you chose for your new VG. > 11. Edit /mnt/boot/grub/menu.lst???? > > STUMPED AGAIN. Here's an example of a kernel line from my > /boot/grub/menu.lst > kernel /vmlinuz-2.6.12-10-686-smp > root=/dev/mapper/Ubuntu-root ro quiet splash > > DO I REALLY NEED TO CHANGE ANYTHING HERE??? Only the name of the new VG. I have found newer systems using partition labels, too, but I'm old school -- I find that more confusing than helpful. If I have two partitions called "boot", what then? ( Actually the system won't let you do that, but it does add complication for me. ) > If so how does it > interact with ubuntu/debians automagic updates to this file on new > kernel package installs? No issue. This is "/boot" for your system. > 12. Install grub on the new drive so we can still boot > $sudo grub-install /dev/sdb > grub > grub: device (hd0) /dev/sdb > grub: root (hd0,0) > grub: setup (hd0) > grub: quit At this point, although I am not a GRUB expert, I think you are wrong. If, as I expect, we are going to physically swap the two SCSI devices, you won't be booting /dev/sdb any more. Also, this is suggesting to me that your /boot is on /dev/hda. ( all of those hd0 lines ) Unless the device command is telling it that sdb IS hd0? Which, if you swap drives, would no longer be correct. If however, you don't swap drives and just boot to /dev/sdb instead of /dev/sda -- I see where you are going. It just might work. Again, ask a GRUB expert about the possibilities. > QUESTION: The debian-admin article had this as grub-install > /dev/sda but this surely must be a typo since grub is already > installed on /dev/sda YES? True. > 13. For the triskadecaphobic, there is no step 13 <G> B-) > 14. Copy the new /etc/fstab and grub configuration to the old drive > $sudo cp -p /mnt/root/etc/fstab /etc > $sudo cp -p /mnt/boot/grub/menu.1st /boot/grub Not yet. You want to leave the old drive as clean as possible. > 15. Cross fingers and reboot > QUESTION: How do I know it worked. The debian-admin says to > use df and see that / is mounted on /dev/md0, but I think that it's > still going to show it mounted on /dev/mapper/Ubuntu-root True -- except that it is no longer "Ubuntu". It can't be. Test thoroughly! At least far enough to make sure that this is the "same machine." > 16. Now add /dev/sda5 to the raid > $sudo mdadm --add /dev/md0 /dev/sda5 HERE is where you change the partition type of /dev/sda. At this point you are committed. > 17. Wait until the md finishes syncing the drives > $watch cat /proc/mdstat Yup. > It's done when this shows a status of [UU] for /dev/md0 Correct. > -- > Rick DeNatale Brian McCullough
smime.p7s
Description: S/MIME cryptographic signature
-- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
