[clug] hot-swap (hotplug) sata, Intel ICH7 controller

Steve Granger steveg at magellan-technology.com
Thu Apr 26 06:20:42 GMT 2007


Hi,

Thanks for your input Chris and Andrew. I might leave swap remaining on
a separate partition for the time being.

When I reboot the machine now the swap partition is only coming up with
one partition active.

[   51.649303] md: md0 stopped.
[   51.743026] md: bind<sdb1>
[   51.743186] md: bind<sda1>
[   51.781672] raid1: raid set md0 active with 2 out of 2 mirrors
[   51.781773] md: md1 stopped.
[   51.833057] md: bind<sdb2>
[   51.854746] raid1: raid set md1 active with 1 out of 2 mirrors

if I try and simple re-add /dev/sda1 to the array it gives me the error
message

root at backup:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1]
      1951888 blocks super 1.0 [2/1] [_U]

md0 : active raid1 sda1[0] sdb1[1]
      144544 blocks super 1.0 [2/2] [UU]

md2 : active raid1 sda3[0] sdb3[1]
      486287412 blocks super 1.0 [2/2] [UU]

unused devices: <none>
root at backup:~# mdadm --manage --add /dev/md1 /dev/sda2
mdadm: Cannot open /dev/sda2: Device or resource busy
root at backup:~#

 mdadm -QD /dev/md1
/dev/md1:
        Version : 01.00.03
  Creation Time : Mon Apr 23 12:40:12 2007
     Raid Level : raid1
     Array Size : 1951888 (1906.46 MiB 1998.73 MB)
    Device Size : 1951888 (1906.46 MiB 1998.73 MB)
   Raid Devices : 2
  Total Devices : 1
Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Thu Apr 26 11:47:25 2007
          State : clean, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : 1
           UUID : 933a9941:aa2254d7:bcdfcd50:641429b2
         Events : 8

    Number   Major   Minor   RaidDevice State
       0       0        0        0      removed
       1       8       18        1      active sync   /dev/sdb2

I first have to disable swap and then add the device

root at backup:~# mdadm --manage /dev/md1 --add /dev/sda2
mdadm: Cannot open /dev/sda2: Device or resource busy
root at backup:~# swapoff -a
root at backup:~# mdadm --manage /dev/md1 --add /dev/sda2
mdadm: re-added /dev/sda2
root at backup:~# swapon -a


Another point, has anyone been able to manipulate the resync speeds on a
Ubuntu/Debian system? I can't seem to raise the performance above it's
default. I've tried changing these values

/sys/block/md2/md/sync_speed_min 1000 (system)
/sys/block/md2/md/sync_speed_max 200000 (system)

but there is no improvement. Googling found old (6months +) posts about
how changing these values didnt' affect the Debian kernels. The
linux-server-image has shaping for RAID 5 enabled. My array is RAID 1.


Andrew Janke wrote:
> On 4/24/07, Steve Granger <steveg at magellan-technology.com> wrote:
> 
>> Drives are coming up as /dev/sda and /dev/sdb.
> 
> Good good, so no ata_piix wierdness is happening.
> 
>> my partitions are as such.
>> /dev/md0 (/dev/sda1, /dev/sdb1)  - /boot - 150MB
>> /dev/md1 (/dev/sda2, /dev/sdb2)  - swap - 2GB
>> /dev/md2 (/dev/sda3, /dev/sdb3)  - / - 464GB
>>
>> I just went into the bios and changed the SATA mode from compatible to
>> Enhanced. I left the SATA RAID disabled and enabled SATA AHCI booted and
>> was able to unplug the device without the system hanging, the mdadm
>> monitor process also told me the raid had failed!
> 
> Sorry, I forgot to mention that AHCI is needed (well it was in my case
> too!).  Glad to see you found it. :)
> 
>> However cat /proc/mdstat showed that one of the raid arrays was still up
>> and running. /dev/md1 still had UU status. This is the drive with the
>> swap partition on it. No swap was in use. Seeing the drive didn't
>> actually exist in /dev I couldn't do a
>> mdadm --manage /dev/md1 --fail /dev/sdb2
>>
>> I plugged the drive back in and the drive came back up as /dev/sdc  ...
>> not /dev/sdb which originally was. I rebooted and it came back up as
>> /dev/sdb.
>>
>> When a drive fails will I somehow need to notify udev that it has been
>> removed?
> 
> When I did this I was using scsidev so that  could get consistent
> mountpoints for real SCSI devices.  I do know you can resort to
> skullduggery such as this:
> 
>   echo 1 > /sys/class/scsi_device/1\:0\:0\:0/device/delete
> 
> When ejecting things on Thinkpads and the likes.  Perhaps the same has
> to be done with udev and HDDs?
> 
> The other option (From a quick scan of man mdadm.conf is to use uuids
> for the partitions, this should get around your problem.

here's the contents of /dev/mdadm/mdadm.conf

ARRAY /dev/md0 level=raid1 num-devices=2 name=0
UUID=b91754b1:9df6f10e:a500d013:75eee980
ARRAY /dev/md1 level=raid1 num-devices=2 name=1
UUID=933a9941:aa2254d7:bcdfcd50:641429b2
ARRAY /dev/md2 level=raid1 num-devices=2 name=2
UUID=ad98bc95:188788a1:8613855b:1b2556ed

Not having the harddrive return as /dev/sdb (or whatever it previously
was) is a real problem as it seems impossible to add the new partitions
off the new disk to the arrays.

It won't allow me to remove the faulty partition from the array.

root at backup:~# mdadm --manage /dev/md0 --remove /dev/sdb1
mdadm: cannot find /dev/sdb1: No such file or directory

or add the new partition

root at backup:~# mdadm --manage /dev/md0 --add /dev/sdc1
mdadm: add new device failed for /dev/sdc1 as 2: Device or resource busy

Which leaves me to rebooting to bring the array back up into an active
(resync-ing) state which is not really what I want.

--
Steve

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


More information about the linux mailing list