Solved

dd and lilo boot to 2nd hard drive

Posted on 2000-04-13
6
303 Views
Last Modified: 2013-12-16
Hello,

I run a cron job that copies the 1st hard drive in my linux redhat 6.0 server to my 2nd hd. I use the following command: dd bs=81920 if=/dev/hda of=/dev/hdb

I do this in the event of an hda crash, I could possibly change the /etc/fstab file and pass lilo some parms and boot to my 2nd hard drive and be up and running. Also, I've got a new distribution release I'd like to reinstall fresh to hda and while I'm readying that for production during business hours I'd like to run off the 2nd hd on the older release.

My question is what parms do I need to pass to lilo to make this happen. I don't want to use a floppy if possible that's something extra to keep track of. Also, I thought I could do this straight from the lilo boot prompt and not have to hack the lilo.conf file.

We currently do this on our Sun Solaris machines and it works great. It gives you a good safety net as well. On a Sun box you can nvalias the boot path to a 2nd disk and at the OK prompt give the command boot <alias-name> and away you go.

Any ideas?

0
Comment
Question by:cd02154
6 Comments
 
LVL 4

Expert Comment

by:kiffney
ID: 2712130
From the lilo boot prompt you could just type
 
boot=/dev/hdb

to boot off that drive.  You would probably also have to add

root=/dev/hdb1
replacing hdb1 with whatever the root partition is, since linux stores the root partition name inside the kernel and you'll need to tell it to use a different root partition.   I don't think lilo (at least the version I'm using) can switch automatically - that would be a neat feature.  There's a Bootprompt-HOWTO with many kernel parameters like this you can set at boot time.
0
 
LVL 4

Expert Comment

by:kiffney
ID: 2712159
On further thought, you wouldn't need to do all this if hda were yanked, as hdb would now be hda.  But if hda was still in the machine, your /etc/fstab would still need to be edited - maybe you'd have to boot into 'single' mode and do all that.  The nvalias thing sounds neat but I don't know if Linux has that.
0
 
LVL 2

Expert Comment

by:bernardh
ID: 2714168
edit and add an entry to your /etc/lilo file

   label=linux2
   table=/dev/hdX

replace X with the name of your hard disk drive

re-read lilo with the command
 
   /sbin/lilo -v

reboot...when lilo prompt appears, press tab, select linux2



0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 1

Expert Comment

by:toddrose
ID: 2714605
Several steps are needed for this to work smoothly.

1. You can boot with the RedHat CD and use this at th boot: prompt

root=/dev/hdb1 read-write

use the correct /dev that contains the '/' system.

I'm not sure if you can send any other partitions like /usr or /home.

you must use 'read-write' or the system will not be able to update system files or even boot cleanly.

2. (or possibly first) if you have multiple partitions listed in /etc/fstab they will have to be modified prior to attempting to boot for the second drive.  This should be do-able if you mount the second drive and edit the /etc/fstab entries in place.

3. Ideally I would recommend making a boot disk using a 'special' lilo.conf file.  This way you will know that you can boot up before you destroy /dev/hda.  This will also allow your system to reboot without user intervention after hours or any other time it is unattended.
0
 

Author Comment

by:cd02154
ID: 2723753
Kiffney,

You solution worked out the best for me. If you want to propose an answer I'll get you your points.

I ended up using the following at the lilo prompt: linux boot=/dev/hdb root=/dev/hdb8

That did exactly what I wanted.

Thanks!
0
 
LVL 4

Accepted Solution

by:
kiffney earned 100 total points
ID: 2723798
Sure, I'll propose this as an answer.  I think there is an option for you (as the questioner) to 'accept comment as answer' (but I'm not sure about that)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question