[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Thanks...this is truly what the Open Source communityisall about

Les Mikesell wrote:

From: Dan Young

Yeah, is it just me or should /proc/mdstat give some sort of dire
warning here?

An underscore doesn't exactly scream "your RAID array is broke", given
that's what it means in this context. Not quite as verbose as "lpX on
fire". ;-)

Well the point of a raid is that you aren't really broken as long as half is still there, but I agree that there should be some kind of warning logged when the spare isn't working. The 'smartmontools' should probably get better press too.

Anyway if you want to play with hot-swaps, I've found this
procedure to work:

Save the result of 'fdisk -l' and 'cat /proc/mdstat' before

Hot-swap drives can be removed after giving the commands:
First deactivate the partition(s) from the raid devices
mdadm /dev/mdxx -–fail /dev/sdxx (xx's are raid device/partition to mark failed)
mdadm /dev/mdxx -–remove /dev/sdxx (same – must not be active)
Repeat for all partitions if there are more than one.
Then 'logically' remove the drive
echo "scsi remove-single-device 0 0 N 0">/proc/scsi/scsi
where the four numbers are;
controller (0 if you  only have one)
channel    (0 for most)
scsi id  (0,1,3,4,5,9 in IBM Netfinity hot-swap bay positions)
lun      (0 for most)
(give command before removing)
At this point you can physically remove the drive without
any complaints from the system.

A replacement drive can be added with:
echo "scsi add-single-device 0 0 N 0">/proc/scsi/scsi
(after installing the device - it should be detected as the
one just removed)
fdisk if needed to create partition(s)
 mdmadm /dev/mdxx –add /dev/sdxx (partition to hotadd and rebuild)
cat /proc/mdstat to see rebuild progress and status

Mdadm is the more up to date replacement for the raidtools like

You can 'clone' a machine this way if you are careful to fix the
hostname and ip address of the machine receiving the loaded drives,
but you do have to be careful about mixing the drives up or putting
drives with non-matching raid sets in a machine and rebooting.  The
auto-detect/rebuild function seems to be easily confused.

  Les Mikesell
  les futuresource com

_______________________________________________ K12OSN mailing list K12OSN redhat com https://www.redhat.com/mailman/listinfo/k12osn For more info see <http://www.k12os.org>

Some good tips Les. That use of /proc/scsi/scsi was a new one for me. I'll be experimenting with that when I next get some time on a test machine with hot-pluggable drives. Thanks.

Here are a couple more notes I have collected to expand the learning opportunity for those new to raid.
First I'd like to note that there is included in the mdadm package an mdmonitor service, which can be used to monitor your raid arrays and either send an email notification or run a script/program. Check out /etc/mdadm.conf and try uncommenting and editing the MAILADDR line 2nd from the bottom. With that enabled enter 'service start mdmonitor' to begin monitoring. By default the service is enabled in runlevels 2-5 but exits quietly when neither MAILADDR nor PROGRAM are configured. So you can get email notification of raid problems. A proactive system that monitors itself! Now you don't have to count on checking for missing mirrors in /proc/mdstat often enough to notice one bad mirror before it becomes two bad mirrors. Gotta love it.

Another good thing to know is that grub does not by default install its bootloader in the MBR of both drives of a raid 1 array. If the first drive fails you would need a boot floppy or cd to bring the system up. But that can be avoided...

Scenario: System with two hard drives (sda, sdb) mirrored for redundancy.

The 1st drive in the BIOS is sda and the 2nd drive is sdb. Grub is installed on the MBR of sda during the O/S installation. We need it installed on the MBR of sdb as well in case the 1st drive fails and the system reboots.

The trick is the grub device command issued before the root and setup commands.

While the system is booted up with both drives operational type the following commands as root:

[root spongebob]# grub
grub> device (hd0) /dev/sdb # This will set (hd0) to be the 2nd drive for the subsequent commands
grub> root (hd0,0) # This will set the root device to be the 1st partition of the 2nd drive (location of /boot/grub directory in md1 in sdb1 for your system Dave)
grub> setup (hd0) # This will write the boot information to the MBR on the 2nd drive
grub> exit

Chris Johnson, RHCE #807000448202021

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]