Subject: 3ware's twedm for NetBSD/alpha
To: None <port-alpha@netbsd.org>
From: Mr Raymond Phillips <r.phillips@uq.edu.au>
List: port-alpha
Date: 10/14/2005 15:42:48
For reference, John Heasley has made an alpha binary of twedm, the 3ware
RAID controller command line interface configuration tool, and its man
page available at:

  http://www.shrubbery.net/~heas/twedm.alpha
  http://www.shrubbery.net/~heas/twedm.8

so it's no longer necessary to configure arrays with the controller and
disks plugged into an i386 machine before installing them in an
alpha--nor necessary to move them back to an i386 to rebuild an array if
it becomes degraded.

The binary was compiled under NetBSD/alpha 2.0 and I've tried it briefly
on a 164LX running 2.0.2, as shown in the output appended to this
message.  Apparently the "Terminal error" message which appears when
exiting from twedm doesn't happen if -current twe sources are used.

A few things are necessary before an alpha can use twe(4)...

- Add these two lines to /usr/src/sys/arch/alpha/conf/GENERIC:

twe*    at      pci? dev ? function ?   # 3ware Escalade RAID controllers
ld*     at      twe? unit ?

and this one to /usr/src/sys/arch/alpha/conf/majors.alpha:

device-major    twe             char 97                 twe

then build a new kernel and reboot from it.

- Create a twe entry in /dev/MAKEDEV:

% diff -c MAKEDEV.orig MAKEDEV
*** MAKEDEV.orig        Tue Mar 22 13:44:23 2005
--- MAKEDEV     Fri Oct 14 14:45:32 2005
***************
*** 722,727 ****
--- 722,732 ----
        mkdev mlx$unit c 65 $unit
        ;;

+ twe*)
+       unit=${i#twe}
+       mkdev twe$unit c 97 $unit
+       ;;
+
  agp*)
        unit=${i#agp}
        mkdev agp$unit c 67 $unit 644

(I don't know this file well enough to be able to say if the location of
these extra lines is significant.)  Then create a twe device:

# cd /dev
# ./MAKEDEV twe0

I suppose the 3ware card would work at this stage without a further
reboot?  From memory I did reboot to be sure.

Unless I've forgotten something that's enough to get twedm functioning.


Ray



Sample output:

# ls -l
total 520
-rwx------  1 ray  wheel  508116 Sep 19 13:38 twedm
-rw-r-----  1 ray  wheel    8079 Sep 19 13:38 twedm.8
# ls -l /dev/twe*
crw-------  1 root  wheel  97, 0 Oct  5 14:38 /dev/twe0
# ./twedm /dev/twe0
Warning: This code is of alpha quality, has had very little testing,
         may destroy arrays on a whim.  Use it at your own risk.  I can
         not be held accountable!

twedm> show controller
        Model          : 8506-4LP
        # ports        : 4
        Serial Number  : F14402A4155002
        Firmware       : FE8S 1.05.00.068
        BIOS           : BE7X 1.08.00.048
        PCB            : Rev5
        Achip          : 3.20
        Pchip          : 1.30-66
        Monitor        : ME7X 1.01.00.040
twedm> show drives
        Port  0: Present        ST3120026AS
                                3JT4HXBN
                                unit  0
        Port  1: Present        ST3120026AS
                                3JT4HVFK
                                unit  0
        Port  2: Present        ST3120026AS
                                3JT4HTMA
                                unit  0
        Port  3: Present        ST3120026AS
                                3JT4JN4Y
                                unit  0

(A RAID5 array had been configured on the 3ware controller before it was
plugged into the alpha.)

twedm> show units
        1 units
        Unit  0: Online, Normal
                 RAID5, 64k stripe
                 4 sub-units
                 703318656 blocks
twedm> show units verbose
        1 units
        Unit  0: Online, Normal
                 RAID5, 64k stripe
                 4 sub-units
                 703318656 blocks
                 sub-unit 0: port 0
                 sub-unit 1: port 1
                 sub-unit 2: port 2
                 sub-unit 3: port 3
twedm> show settings
Rebuild rate 2 (Fast rebuild)

Unit 0 cache on
twedm> show alarms
(0x01)  Soft reset
(0x01)  Soft reset  <-- This line repeated many times--more than the
terminal buffer could hold.
twedm> show units
        1 units
        Unit  0: Online, Normal
                 RAID5, 64k stripe
                 4 sub-units
                 703318656 blocks
twedm> unit delete 0
WARNING:        About to delete unit 0.  This COMPLETELY destroys the
                unit.  UNRECOVERABLE!  If this unit is in use, deleting
                it WILL cause problems!
Delete unit 0 (y/n)? y
twedm> help unit create
Create unit <type> <port N...>
Usage: unit create (raid(0|1|10) [(4|8|16|32|64)k)]|raid5|jbod) <port N ...>
twedm> show drives
        Port  0: Present        ST3120026AS
                                3JT4HXBN
                                unit --
        Port  1: Present        ST3120026AS
                                3JT4HVFK
                                unit --
        Port  2: Present        ST3120026AS
                                3JT4HTMA
                                unit --
        Port  3: Present        ST3120026AS
                                3JT4JN4Y
                                unit --
twedm> unit create raid1 64k 0 1
twedm> unit create raid1 64k 2 3
twedm> show units
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
twedm> show units verbose
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
                 sub-unit 0: port 0
                 sub-unit 1: port 1
        Unit  2: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
                 sub-unit 0: port 2
                 sub-unit 1: port 3
twedm> show drives
        Port  0: Present        ST3120026AS
                                3JT4HXBN
                                unit  0
        Port  1: Present        ST3120026AS
                                3JT4HVFK
                                unit  0
        Port  2: Present        ST3120026AS
                                3JT4HTMA
                                unit  2 (sub-unit  0)
        Port  3: Present        ST3120026AS
                                3JT4JN4Y
                                unit  2 (sub-unit  1)
twedm> unit verify 0
twedm> unit verify 2

From /var/log/messages:
Oct 13 10:51:19 test /netbsd: twe0: unit 0: array not previously initialized
Oct 13 10:51:19 test /netbsd: twe0: unit 0: initialization started
Oct 13 10:51:38 test /netbsd: twe0: unit 2: array not previously initialized
Oct 13 10:51:38 test /netbsd: twe0: unit 0: initialization started

twedm> show units
        2 units
        Unit  0: Online, Initializing (3%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Initializing (0%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
twedm> unit attach 0
twedm> show units
        2 units
        Unit  0: Online, Initializing (11%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Initializing (0%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
twedm> unit attach 2
twedm> show units verbose
        2 units
        Unit  0: Online, Initializing (12%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
                 sub-unit 0: port 0
                 sub-unit 1: port 1
        Unit  2: Online, Initializing (0%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
                 sub-unit 0: port 2
                 sub-unit 1: port 3
twedm>

From /var/log/messages:
Oct 13 11:00:36 test /netbsd: ld0 detached
Oct 13 11:00:36 test /netbsd: ld0 at twe0 unit 0: RAID1, status:
Initializing
Oct 13 11:00:36 test /netbsd: ld0: 111 GB, 14593 cyl, 255 head, 63 sec,
512 byte
s/sect x 234439600 sectors
Oct 13 11:00:57 test /netbsd: ld1 at twe0 unit 2: RAID1, status:
Initializing
Oct 13 11:00:57 test /netbsd: ld1: 111 GB, 14593 cyl, 255 head, 63 sec,
512 byte
s/sect x 234439600 sectors

twedm> show units
        2 units
        Unit  0: Online, Initializing (78%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Initializing (0%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks

From /var/log/messages:
Oct 13 12:20:42 test /netbsd: twe0: unit 0: initialization done
Oct 13 12:20:42 test /netbsd: twe0: unit 2: initialization started

twedm> show units
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Initializing (3%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
twedm> show units
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks

From /var/log/messages:
Oct 13 14:39:56 test /netbsd: twe0: unit 2: initialization done

When one of the disks was unplugged without warning:

twedm> show units
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Degraded
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks

From /var/log/messages:
Oct 13 15:03:51 test /netbsd: twe0: port 2: drive error
Oct 13 15:03:51 test /netbsd: twe0: unit 2: degraded mode

After the disk had been reinserted:

twedm> unit rebuild 2

From /usr/var/log/messages:
Oct 13 15:08:40 test /netbsd: twe0: unit 2: rebuild started

twedm> show units
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Rebuilding (5%)
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
twedm> show units
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
        Unit  2: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks

From /usr/var/log/messages:
Oct 13 16:19:39 test /netbsd: twe0: unit 2: rebuild done

twedm> show units verbose
        2 units
        Unit  0: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
                 sub-unit 0: port 0
                 sub-unit 1: port 1
        Unit  2: Online, Normal
                 RAID1, 64k stripe
                 2 sub-units
                 234439600 blocks
                 sub-unit 0: port 2
                 sub-unit 1: port 3
twedm> exit
Terminal error
#