Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy and boot root from software raid 2

Status
Not open for further replies.

verland

MIS
Apr 24, 2002
138
US
I read the raid howto, made a raid1 (mirror) and want to move my / filesystem onto it and boot from it. Can this be done? The howto didn't really say how, he said you could copy root then tweak lilo and do it but no real procedure.

I don't have my setup in front of me but it is something like this:

sda1 16gig, member of raid /dev/md0
sdb1 the same
sda5 1gig, root filesystem ("/")
sdb2 1gig, pagefile

Those numbers might not be exact but they are close. So I guess these are my questions:
How do you copy the / partition to something else?
What do you tell LILO? I've only used lilo for changing what kernel to boot off of so far.
How does the system even start to boot off a software raid, how's the kernel start? Am I going to need a boot floppy instead?
I found a root-raid howto but it is obsoleted. Also read some older posts but nothing covered copying /. Thanks for any help!
 
I haven't run raid, but here goes:
Mount the partition that will be the new / and copy over what you want. Let's call the mount point /root2. Make any changes to the fstab on the new root so everything is mounted correctly. Now for lilo you have two ways of doing this

1. change /root2/etc/lilo.conf and set 'root = ' to the new partition. Next run /sbin/lilo -v -C /root2/etc/lilo.conf and lilo will updated in your MBR. That said, I would do the next method first

2. With everything copied, set your drives how you want them in the computer. At boot, at the lilo prompt type:
'linux root=/dev/hdxn' and enter the new partition. This way you can test before changing your MBR.

P.S. if lilo boots the new partition, but the kernel panics or won't mount, fall back to your old setup and on the kernel in /root2/boot run 'rdev /root2/boot/vmlinuz /dev/hdxn' to set the new partition in the kernel.

HTH
 
Thanks a lot jaym, but I still have some lame questions about copying /. I assume (only because I tried and it didn't work) that you can't do this on a running system. So I think I need to boot off Debian Rescue or something. But if that doesn't support raid1 then I can't copy it. Should I make a boot disk for my system or is there a way to copy it while it's up?
Can't wait to try the rest

Thanks again Vern
 
What if you just did a fresh Linux install on the RAID drives, left your old drives intact, and then just copied your important data over to the new Linux system? That seems like the easiest thing to do to me. If you ran into a problem, you would still have the old drives to fall back on. You have nothing to lose trying this; you could even pull the old drives out of the machine while your installing Linux on the RAID to be extra safe.


ChrisP ------------------------------------------------------------------------------
If somebody helps you, please vote for them for "Tipmaster of the Week" by giving them a "purple star". This can be done by clicking the "Mark this post as a helpful/expert post" button.
 
Fluid-
That's one thing I was wondering about (and why I asked about live reinstalls in another post). Do a no frills install, build a raid kernel, boot off of it, build the raid, start your real install into the raid (doable?) but copy the raid kernel onto it before the reboot, configure lilo and *tab, then reboot.

At least that's the best I can come up with w/o copying /. Not sure how that's done. And a lot (most?) of the above can probably be avoided with a raidkernel boot disk/cd but I don't know how that's done yet either.
The system only has the two drives. There is however no data, yet, that's why I have no shame messing with it. Your plan sounds cool and is surely food for thought. I'll look at the posts then look at the hardware and see what I come up with.

thanks all
 
check out which is a rescue CD with raid support. What fluid11 suggested would work to. As for copying, you can do that on a live system, you don't need a boot floppy. You would only hit issues trying to copy named pidpes and stuff like that. A simple 'cp -avR /here /there' will handle it (the options let you know what's happening, preserves links and also permissions). you said you tried to copy before, what went wrong?
 
Jay: thank you again. I will check this out when I'm behind the machine in question.
About the / copy? I wasn't going to mention it, but as I said I have no shame about this server....

As root, I just did a (no laughing, I had no idea what to do) cp * -r /mnt/md0 , i believe. It did start to do it, but I didn't babysit it. It took an awful lot of proc time and the system got kinda slow (slowest I've ever seen Linux). Then it stated a scsi parity error that it seemed to recover from and which I'm still puzzling out. In the end, the >400 meg Debian install wound up using the whole 16gb of /mnt/md0. I stopped the cp and wasn't sure what went wrong, it did copy at least a few directories then got stuck in a loop or something. /mnt/md0 was completely empty before the copy (not even a lost+found). But I erased all evidence that I'd tried and I left it at that. :)
 
Check your syntax, you had cp * -r /mnt/md0 when it should have been cp -r * /mnt/md0. Also, if you try again, add the -a option or -pdvR if you want to preserve links.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top