CentOS release 4.5
Hi All:
First of all I will admit to being spoiled by my MegaRAID SCSI RAID controllers. When a drive fails on one of them I just replace the drive and carry on with out having to do anything else.
I now find myself in the situation where I have a failed drive on a non-MegaRAID controller, specifically an Adaptec 29160 SCSI controller. The system is an Acer G700 with 8 internal hot-swappable SCSI drives arranged in two banks of 4 drives. Each bank is connected to a separate channel on the 29160 controller. When I installed CentOS 4 I enable software mirroring between the two banks so that I ended up with 4 pairs of mirrored drive (sda/sde, sdb/sdf, sdc/sdg, sdd/sdh).
The problem I have now is that it is sda (the boot drive) that has failed. I have not encountered this problem before and therefore I need to make sure that I understand what I need to do before I start mucking around with things and dig myself into a deeper hole.
I have spent much time attempting to research the problem but have not been able to come with any definite information to help. As far as I can see I have two options...
Option 1: Leave the system running and replace the drive. Then either the RAID software will re-sync the drives or I can manually sync them with mdadm. I have not seen anything that will support this option but I am hoping that it is a valid option.
Option 2: Create a boot disk (floppy or CD) that I can boot from but that points to sde (the boot mirror). Shutdown the system and replace the failed sda drive. Boot from the new boot disk. Format, partition and re-sync the new sda from sde. Shutdown, remove the boot disk, and reboot from the new sda.
Can anyone confirm either of these options and point me in the right direction to any documentation that would assist me.
TIA
Regards, Hugh
Hugh E Cruickshank wrote:
I now find myself in the situation where I have a failed drive on a non-MegaRAID controller, specifically an Adaptec 29160 SCSI controller. The system is an Acer G700 with 8 internal hot-swappable SCSI drives arranged in two banks of 4 drives. Each bank is connected to a separate channel on the 29160 controller. When I installed CentOS 4 I enable software mirroring between the two banks so that I ended up with 4 pairs of mirrored drive (sda/sde, sdb/sdf, sdc/sdg, sdd/sdh).
Normally with software mirroring you would mirror partitions, not drives. What does "cat /proc/mdstat" say about them?
The problem I have now is that it is sda (the boot drive) that has failed. I have not encountered this problem before and therefore I need to make sure that I understand what I need to do before I start mucking around with things and dig myself into a deeper hole.
I have spent much time attempting to research the problem but have not been able to come with any definite information to help. As far as I can see I have two options...
Option 1: Leave the system running and replace the drive. Then either the RAID software will re-sync the drives or I can manually sync them with mdadm. I have not seen anything that will support this option but I am hoping that it is a valid option.
This should work, but you'll probably have to tell the controller that you are removing and adding disks. This used to be done by writing something to /proc/scsi/scsi, but it may have changed and also may be controller specific so I'll let someone else point out the documentation for that.
Option 2: Create a boot disk (floppy or CD) that I can boot from but that points to sde (the boot mirror). Shutdown the system and replace the failed sda drive. Boot from the new boot disk. Format, partition and re-sync the new sda from sde. Shutdown, remove the boot disk, and reboot from the new sda.
You have an odd combination of drives... Normally you would want to mirror the partitions on the first 2 disks and install grub on both, in which case the system would still boot. Some of the more sophisticated controllers can boot from more than the first 2, though. Anyway, you should be able to boot from your install CD with 'linux rescue' at the boot prompt and get to a point where you can fix things.
From: Les Mikesell Sent: October 7, 2007 16:57
Hi Les. Thanks for your response.
Hugh E Cruickshank wrote:
I now find myself in the situation where I have a failed drive on a non-MegaRAID controller, specifically an Adaptec 29160 SCSI controller. The system is an Acer G700 with 8 internal hot-swappable SCSI drives arranged in two banks of 4 drives. Each bank is connected to a separate channel on the 29160 controller. When I installed CentOS 4 I enable software mirroring between the two banks so that I ended up with 4 pairs of mirrored drive (sda/sde, sdb/sdf, sdc/sdg, sdd/sdh).
Normally with software mirroring you would mirror partitions, not drives. What does "cat /proc/mdstat" say about them?
You are correct. I keep falling back to thinking the "MegaRAID" way where I have the drives mirrored at the controller level and then partitioned at the software level. The /proc/mdstat reports:
Personalities : [raid0] [raid1] md1 : active raid1 sde2[1] sda2[2](F) 8193024 blocks [2/1] [_U]
md2 : active raid1 sde3[1] sda3[2](F) 2048192 blocks [2/1] [_U]
md3 : active raid1 sde5[1] sda5[2](F) 25085376 blocks [2/1] [_U]
md4 : active raid1 sdf1[1] sdb1[0] 35840896 blocks [2/2] [UU]
md5 : active raid1 sdg1[1] sdc1[0] 35840896 blocks [2/2] [UU]
md6 : active raid1 sdh1[1] sdd1[0] 35840896 blocks [2/2] [UU]
md7 : active raid0 sdn1[5] sdm1[4] sdl1[3] sdk1[2] sdj1[1] sdi1[0] 213261312 blocks 256k chunks
md0 : active raid1 sde1[1] sda1[2](F) 513984 blocks [2/1] [_U]
unused devices: <none>
In this configuration sda-sdh are the 29160 attached drives while sdi-sdn are hardware mirrored drive pairs attached to a MegaRAID controller.
The problem I have now is that it is sda (the boot drive) that has failed. I have not encountered this problem before and therefore I need to make sure that I understand what I need to do before I start mucking around with things and dig myself into a deeper hole.
I have spent much time attempting to research the problem but have not been able to come with any definite information to help. As far as I can see I have two options...
Option 1: Leave the system running and replace the drive. Then either the RAID software will re-sync the drives or I can manually sync them with mdadm. I have not seen anything that will support this option but I am hoping that it is a valid option.
This should work, but you'll probably have to tell the controller that you are removing and adding disks. This used to be done by writing something to /proc/scsi/scsi, but it may have changed and also may be controller specific so I'll let someone else point out the documentation for that.
I am glade to hear that. I thought it might be the case but I just did not fell up to trying it by yanking out my boot drive while the system was up and running. That just sounded like a recipe for disaster if I did not have some valid reasoning behind the move. I will wait to see if anyone else weighs in on the subject with some pointers to actual documentation.
Option 2: Create a boot disk (floppy or CD) that I can boot from but that points to sde (the boot mirror). Shutdown the system and replace the failed sda drive. Boot from the new boot disk. Format, partition and re-sync the new sda from sde. Shutdown, remove the boot disk, and reboot from the new sda.
You have an odd combination of drives... Normally you would want to mirror the partitions on the first 2 disks and install grub on both, in which case the system would still boot. Some of the more sophisticated controllers can boot from more than the first 2, though. Anyway, you should be able to boot from your install CD with 'linux rescue' at the boot prompt and get to a point where you can fix things.
The odd combination of drives was actually intentional on my part. The idea was to provide "separation" between the mirrors. While I did not have separate controllers I thought that using the separate channels on the common controller might provide a shade more resiliency. It was my first attempt at setting up mirrored pairs on a non-MegaRAID SCSI controller. Live and learn!
I will read up on the "linux rescue" so, if I have to fallback on this method, I will be able to have a firm plan in place before I start the work.
This particular system is our primary development system and does not get all the "fancy" hardware that our production systems do. I have configured the production systems using only the MegaRAID controllers and there it is a "no brainer" to replace failed drives - just swap the drive and away you go.
Thanks again for your comments. They are greatly appreciated.
Regards, Hugh
Hugh E Cruickshank wrote:
Normally with software mirroring you would mirror partitions, not drives. What does "cat /proc/mdstat" say about them?
You are correct. I keep falling back to thinking the "MegaRAID" way where I have the drives mirrored at the controller level and then partitioned at the software level. The /proc/mdstat reports:
Personalities : [raid0] [raid1] md1 : active raid1 sde2[1] sda2[2](F) 8193024 blocks [2/1] [_U]
md2 : active raid1 sde3[1] sda3[2](F) 2048192 blocks [2/1] [_U]
md3 : active raid1 sde5[1] sda5[2](F) 25085376 blocks [2/1] [_U]
md4 : active raid1 sdf1[1] sdb1[0] 35840896 blocks [2/2] [UU]
md5 : active raid1 sdg1[1] sdc1[0] 35840896 blocks [2/2] [UU]
md6 : active raid1 sdh1[1] sdd1[0] 35840896 blocks [2/2] [UU]
md7 : active raid0 sdn1[5] sdm1[4] sdl1[3] sdk1[2] sdj1[1] sdi1[0] 213261312 blocks 256k chunks
md0 : active raid1 sde1[1] sda1[2](F) 513984 blocks [2/1] [_U]
OK, you just have to replace the drive, fdisk matching partitions on it ("fdisk -l /dev/sde" will show the sizes you need), then use mdadm --add /dev/md? /dev/sda? for each one to add the missing partition back. Then reinstall grub on the drive.
You have an odd combination of drives... Normally you would want to mirror the partitions on the first 2 disks and install grub on both, in which case the system would still boot. Some of the more sophisticated controllers can boot from more than the first 2, though. Anyway, you should be able to boot from your install CD with 'linux rescue' at the boot prompt and get to a point where you can fix things.
The odd combination of drives was actually intentional on my part. The idea was to provide "separation" between the mirrors. While I did not have separate controllers I thought that using the separate channels on the common controller might provide a shade more resiliency. It was my first attempt at setting up mirrored pairs on a non-MegaRAID SCSI controller. Live and learn!
The controller might let you boot from the 2nd channel - and if that's the case you could install grub on /dev/sde before shutting down, adjust the controller bios, and still be able to boot. The catch is that you won't know if it will work until after you shut down..
I will read up on the "linux rescue" so, if I have to fallback on this method, I will be able to have a firm plan in place before I start the work.
The only tricky part is what happens to the drive names if you boot with /dev/sda broken (depending on the failure mode) or missing. If the controller doesn't see it, all of the other drive names will shift up. This normally won't affect md device detection, but you may have a non md device mentioned in /etc/fstab, especially for swap devices.
This particular system is our primary development system and does not get all the "fancy" hardware that our production systems do. I have configured the production systems using only the MegaRAID controllers and there it is a "no brainer" to replace failed drives - just swap the drive and away you go.
It isn't that complicated to fdisk a partition and mdadm --add it, and with software raid1 you gain the ability to plug any remaining single drive into any vendor's scsi controller and access the data.
In article 47098D7B.9020104@gmail.com, Les Mikesell lesmikesell@gmail.com wrote:
The only tricky part is what happens to the drive names if you boot with /dev/sda broken (depending on the failure mode) or missing. If the controller doesn't see it, all of the other drive names will shift up. This normally won't affect md device detection, but you may have a non md device mentioned in /etc/fstab, especially for swap devices.
I normally put swap on a /dev/mdN device too. I have seen different people say you should and you shouldn't, but my reasoning is this: if I have swap just on raw partitions, e.g. /dev/sda2 and /dev/sdb2, what happens if a drive dies while running programs are partly swapped out to the failed drive? I expect at least that the programs would die, and at worst I might get a kernel panic.
But if I am swapping to /dev/md2 that contains /dev/sda2 and /dev/sdb2 in a RAID1 mirror, the swapped-out data is preserved on a drive failure, and the programs should be able to keep running.
Swapping to /dev/mdN certainly seems to work fine, but I haven't yet had a drive failure to test!
Cheers Tony
on 10/8/2007 6:03 AM Tony Mountifield spake the following:
In article 47098D7B.9020104@gmail.com, Les Mikesell lesmikesell@gmail.com wrote:
The only tricky part is what happens to the drive names if you boot with /dev/sda broken (depending on the failure mode) or missing. If the controller doesn't see it, all of the other drive names will shift up. This normally won't affect md device detection, but you may have a non md device mentioned in /etc/fstab, especially for swap devices.
I normally put swap on a /dev/mdN device too. I have seen different people say you should and you shouldn't, but my reasoning is this: if I have swap just on raw partitions, e.g. /dev/sda2 and /dev/sdb2, what happens if a drive dies while running programs are partly swapped out to the failed drive? I expect at least that the programs would die, and at worst I might get a kernel panic.
But if I am swapping to /dev/md2 that contains /dev/sda2 and /dev/sdb2 in a RAID1 mirror, the swapped-out data is preserved on a drive failure, and the programs should be able to keep running.
Swapping to /dev/mdN certainly seems to work fine, but I haven't yet had a drive failure to test!
Cheers Tony
When I use software raid I always use a mirrored swap partition. It is a little slower, but if you lose a drive, the system won't boink. Otherwise, the system will panic if it can't get back from the swap. Of course the best way it to have enough memory that you don't need swap.
From: Les Mikesell Sent: October 7, 2007 18:53
OK, you just have to replace the drive, fdisk matching partitions on it ("fdisk -l /dev/sde" will show the sizes you need), then use mdadm --add /dev/md? /dev/sda? for each one to add the missing partition back.
I have been able to review all this and it looks very straight forward.
Then reinstall grub on the drive.
Now I have some questions:
1. Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
2. Can a install grub on the replaced boot drive with the system still running?
TIA
Regards, Hugh
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
OK, you just have to replace the drive, fdisk matching partitions on it ("fdisk -l /dev/sde" will show the sizes you need), then use mdadm --add /dev/md? /dev/sda? for each one to add the missing partition back.
I have been able to review all this and it looks very straight forward.
Then reinstall grub on the drive.
Now I have some questions:
- Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Boot the system from CD or similar in Rescue Mode and then use something like
grub-install --no-floppy /dev/hda
- Can a install grub on the replaced boot drive with the system still running?
TIA
Regards, Hugh
Yes
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
OK, you just have to replace the drive, fdisk matching partitions on it ("fdisk -l /dev/sde" will show the sizes you need), then use mdadm --add /dev/md? /dev/sda? for each one to add the missing partition back.
I have been able to review all this and it looks very straight forward.
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
In article 470C47EF.2050908@gmail.com, Les Mikesell lesmikesell@gmail.com wrote:
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
OK, you just have to replace the drive, fdisk matching partitions on it ("fdisk -l /dev/sde" will show the sizes you need), then use mdadm --add /dev/md? /dev/sda? for each one to add the missing partition back.
You can also replicate the partitioning of one disk onto another new disk using sfdisk like this:
# sfdisk -d /dev/sda | sfdisk /dev/sdb
The above would partition the new disk /dev/sdb to be exactly like /dev/sda. This assumes both drives are the same size.
This is the sort of command you check three times before pressing ENTER!
I have been able to review all this and it looks very straight forward.
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0)
And also:
root (hd1,0) setup (hd1)
quit
That will ensure both mirrored drives have GRUB in the MBR (the MBR isn't mirrored, only partitions are). Otherwise if hd0 fails, the system will be unable to boot from the good drive hd1.
See http://fedoranews.org/mediawiki/index.php/How_to_setup_and_manage_your_disk_...
Cheers Tony
Tony Mountifield wrote:
- Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0)
And also:
root (hd1,0) setup (hd1)
quit
That will ensure both mirrored drives have GRUB in the MBR (the MBR isn't mirrored, only partitions are). Otherwise if hd0 fails, the system will be unable to boot from the good drive hd1.
See http://fedoranews.org/mediawiki/index.php/How_to_setup_and_manage_your_disk_...
Earlier in the thread, the OP said the 2nd mirror is on sde, not sdb, so this won't work for him and depending on his scsi controller, probably can't boot from that drive at all. In any case it is a good idea to know how to do a rescue mode boot from your install CD.
From: Les Mikesell
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
Sorry to be obtuse here but I just want to make very sure of what I am doing before I do it. Will the "setup" command only write the MBR?
From my reading the GNU GRUB manual I got the distinct impression that
the "setup" command will also write/rewrite the /boot partition (which I would like to avoid). The documentation for the setup command states:
Set up the installation of GRUB automatically. This command uses the more flexible command install (see Section 13.3.18 [install], page 44) in the backend and installs Chapter 13: The list of available commands 49 GRUB into the device install device. If image device is specified, then find the GRUB images (see Chapter 10 [Images], page 29) in the device image device, otherwise use the current root device, which can be set by the command root. If install device is a hard disk, then embed a Stage 1.5 in the disk if possible.
The option --prefix specifies the directory under which GRUB images are put. If it is not specified, GRUB automatically searches them in /boot/grub and /grub.
The options --force-lba and --stage2 are just passed to install if specified. See Section 13.3.18 [install], page 44, for more information.
The second paragraph tends to imply that /boot/grub will be written to by default and I do not think that this is what I want to happen.
Thanks again for everyone's input (especially Les). It is greatly appreciated.
Regards, Hugh
-- Hugh E Cruickshank, Forward Software, www.forward-software.com
on 10/10/2007 2:46 PM Hugh E Cruickshank spake the following:
From: Les Mikesell
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
Sorry to be obtuse here but I just want to make very sure of what I am doing before I do it. Will the "setup" command only write the MBR?
From my reading the GNU GRUB manual I got the distinct impression that
the "setup" command will also write/rewrite the /boot partition (which I would like to avoid). The documentation for the setup command states:
Set up the installation of GRUB automatically. This command uses the more flexible command install (see Section 13.3.18 [install], page 44) in the backend and installs Chapter 13: The list of available commands 49 GRUB into the device install device. If image device is specified, then find the GRUB images (see Chapter 10 [Images], page 29) in the device image device, otherwise use the current root device, which can be set by the command root. If install device is a hard disk, then embed a Stage 1.5 in the disk if possible. The option �--prefix� specifies the directory under which GRUB images are put. If it is not specified, GRUB automatically searches them in �/boot/grub� and �/grub�. The options �--force-lba� and �--stage2� are just passed to install if specified. See Section 13.3.18 [install], page 44, for more information.
The second paragraph tends to imply that /boot/grub will be written to by default and I do not think that this is what I want to happen.
Thanks again for everyone's input (especially Les). It is greatly appreciated.
What "setup" command? You boot from a rescue disk if your system isn't running already. If booting from rescue disk chroot to your installed files. execute grub at its prompt run the following; root (hd0,0) setup (hd0) quit That should let you boot into your stuff.
From: Scott Silva Sent: October 10, 2007 15:15
on 10/10/2007 2:46 PM Hugh E Cruickshank spake the following:
From: Les Mikesell
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
Sorry to be obtuse here but I just want to make very sure of what I am doing before I do it. Will the "setup" command only write the MBR?
From my reading the GNU GRUB manual I got the distinct impression that
the "setup" command will also write/rewrite the /boot partition (which I would like to avoid). The documentation for the setup command states:
Set up the installation of GRUB automatically. This command uses the more flexible command install (see Section 13.3.18 [install], page 44) in the backend and installs Chapter 13: The list of available commands 49 GRUB into the device install device. If image device is specified, then find the GRUB images (see Chapter 10 [Images], page 29) in the device image device, otherwise use the current root device, which can be set by the command root. If install device is a hard disk, then embed a Stage 1.5 in the disk if possible. The option �--prefix� specifies the directory under which GRUB images are put. If it is not specified, GRUB automatically searches them in �/boot/grub� and �/grub�. The options �--force-lba� and �--stage2� are just passed to install if specified. See Section 13.3.18 [install], page 44, for more information.
The second paragraph tends to imply that /boot/grub will be written to by default and I do not think that this is what I want to happen.
Thanks again for everyone's input (especially Les). It is greatly appreciated.
What "setup" command?
That would be the grub setup command.
You boot from a rescue disk if your system isn't running already. If booting from rescue disk chroot to your installed files. execute grub at its prompt run the following; root (hd0,0) setup (hd0) quit That should let you boot into your stuff.
I know that will let me boot but that was not what I was asking about. As per the documentation I quoted it appears that the grub setup command will overwrite the /boot partition that has been restored from the mirror drive. As far as I can see that is not desirable. All I want to do is install the GRUB MBR and leave the contents of the /boot partition intact.
My question is basically will the grub setup command only install the MBR or will it also overwrite the /boot partition as well?
Regards, Hugh
on 10/10/2007 3:36 PM Hugh E Cruickshank spake the following:
From: Scott Silva Sent: October 10, 2007 15:15
on 10/10/2007 2:46 PM Hugh E Cruickshank spake the following:
From: Les Mikesell
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
Sorry to be obtuse here but I just want to make very sure of what I am doing before I do it. Will the "setup" command only write the MBR?
From my reading the GNU GRUB manual I got the distinct impression that
the "setup" command will also write/rewrite the /boot partition (which I would like to avoid). The documentation for the setup command states:
Set up the installation of GRUB automatically. This command uses the more flexible command install (see Section 13.3.18 [install], page 44) in the backend and installs Chapter 13: The list of available commands 49 GRUB into the device install device. If image device is specified, then find the GRUB images (see Chapter 10 [Images], page 29) in the device image device, otherwise use the current root device, which can be set by the command root. If install device is a hard disk, then embed a Stage 1.5 in the disk if possible. The option �--prefix� specifies the directory under which GRUB images are put. If it is not specified, GRUB automatically searches them in �/boot/grub� and �/grub�. The options �--force-lba� and �--stage2� are just passed to install if specified. See Section 13.3.18 [install], page 44, for more information.
The second paragraph tends to imply that /boot/grub will be written to by default and I do not think that this is what I want to happen.
That paragraph should read stored not put. It assumes that the grub files needed are already there. The commands below work. grub-install and other variants are shell scripts to accomplish the same thing.
Thanks again for everyone's input (especially Les). It is greatly appreciated.
What "setup" command?
That would be the grub setup command.
You boot from a rescue disk if your system isn't running already. If booting from rescue disk chroot to your installed files. execute grub at its prompt run the following; root (hd0,0) setup (hd0) quit That should let you boot into your stuff.
I know that will let me boot but that was not what I was asking about. As per the documentation I quoted it appears that the grub setup command will overwrite the /boot partition that has been restored from the mirror drive. As far as I can see that is not desirable. All I want to do is install the GRUB MBR and leave the contents of the /boot partition intact.
My question is basically will the grub setup command only install the MBR or will it also overwrite the /boot partition as well?
Regards, Hugh
Hugh E Cruickshank wrote:
From: Les Mikesell
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
Sorry to be obtuse here but I just want to make very sure of what I am doing before I do it. Will the "setup" command only write the MBR?
Yes, it will verify that the root partition (grub calls /boot root since that's all it knows about) looks right, then write the MBR.
From: Les Mikesell Sent: October 10, 2007 16:37
Hugh E Cruickshank wrote:
From: Les Mikesell
Hugh E Cruickshank wrote:
From: Les Mikesell Sent: October 7, 2007 18:53
Then reinstall grub on the drive.
Now I have some questions:
Since the /boot partition was mirrored and will be restored on the new sda drive I do not really want to do a full grub install. From what I have read that will overwrite existing /boot/grub/grub.conf file. So I just want to write the MBR on the drive. How to I do that (the docs I have found were rather unclear on that aspect)?
Can a install grub on the replaced boot drive with the system still running?
Yes, after the /boot partition re-sync has completed, execute grub and:
root (hd0,0) setup (hd0) quit
If you aren't able to keep the system running while doing the swap, you can also do this from the rescue mode boot, but you should have the contents on the /boot partition first.
Sorry to be obtuse here but I just want to make very sure of what I am doing before I do it. Will the "setup" command only write the MBR?
Yes, it will verify that the root partition (grub calls /boot root since that's all it knows about) looks right, then write the MBR.
Bless you Les. That is just what I was hoping for. Thanks again for all your (and everyone else's) help on this, it has been greatly appreciated.
Regards, Hugh
-- Hugh E Cruickshank, Forward Software, www.forward-software.com