Next Previous Contents

13. Advanced Topics: 5070 Command Reference

In addition to the text based GUI the RAID configuration may also be manipulated from the husky prompt ( the : raid; prompt) of the onboard controller. This section describes commands that a user can input interactively or via a script file to the K9 kernel. Since K9 is an ANSI C Application Programming Interface (API) a shell is needed to interpret user input and form output. Only one shell is currently available and it is called husky. The K9 kernel is modelled on the Plan 9 operating system whose design is discussed in several papers from AT&T (See the "Further Reading" section for more information). K9 is a kernel targeted at embedded controllers of small to medium complexity (e.g. ISDN-ethernet bridges, RAID controllers, etc). It supports multiple lightweight processes (i.e. without memory management) on a single CPU with a non-pre-emptive scheduler. Device driver architecture is based on Plan 9 (and Unix SVR4) STREAMS. Concurrency control mechanisms include semaphores and signals. The husky shell is modelled on a scaled down Unix Bourne shell.

Using the built-in commands the user can write new scripts thus extending the functionality of the 5070. The commands (adapted from the 5070 man pages) are extensive and are described below.

13.1 AUTOBOOT - script to automatically create all raid sets and scsi monitors

13.2 AUTOFAULT - script to automatically mark a backend faulty after a drive failure

13.3 AUTOREPAIR - script to automatically allocate a spare and reconstruct a raid set

This device reconstruction will take anywhere from 10 minutes to one and a half hours depending on both the size and speed of the backends and the amount of activity the host is generating.

During device reconstruction, pairs of numbers will be printed indicating each 10% of data reconstructed. The pairs of numbers are separated by a slash character, the first number being the number of blocks reconstructed so far and the second being the number number of blocks to be reconstructed. Further status about the rebuild can be gained from running rebuild.

When the spare is allocated both the number of spares currently used on the backend and the spare device name is printed. The number of spares on a backend is referred to the depth of spares on the backend. Thus prior to re-engaging the spare after a reconstruction a check can be made to see if the depth is the same. If it is not, then the spare reconstruction failed and reconstruction using another spare is underway (or no spares are available), and hence we don't re-engage the drive.

13.4 BIND - combine elements of the namespace

13.5 BUZZER - get the state or turn on or off the buzzer

13.6 CACHE - display information about and delete cache ranges

13.7 CACHEDUMP - Dump the contents of the write cache to battery backed-up ram

13.8 CACHERESTORE - Load the cache with data from battery backed-up ram

13.9 CAT - concatenate files and print on the standard output

13.10 CMP - compare the contents of 2 files

13.11 CONS - console device for Husky

On a Unix system this is equivalent to:

bind -k unixfd /dev/cons

On a DOS system this is equivalent to:

bind -k doscon /dev/cons

On target hardware using a SCN2681 chip this is equivalent to:

bind -k scn2681 /dev/cons
  • SEE ALSO: unixfd, doscon, scn2681
  • 13.12 DD - copy a file (disk, etc)

    The number after the "+" is the number of fractional blocks (i.e. blocks that are less than the block size) involved. This number will usually be zero (and is otherwise when physical media with alignment requirements is involved).

    A write failure outputting the last block on the previous example would cause the following output:

    Write failed
    
    8+0 records in
    
    7+0 records out
    
  • SEE ALSO: suffix
  • 13.13 DEVSCMP - Compare a file's size against a given value

    13.14 DFORMAT- Perform formatting functions on a backend disk drive

    13.15 DIAGS - script to run a diagnostic on a given device

    13.16 DPART - edit a scsihd disk partition table

    13.17 DUP - open file descriptor device

    13.18 ECHO - display a line of text

    \c suppress trailing newline

    \f form feed

    \n new line

    \r carriage return

    \t horizontal tab

    \v vertical tab

    \\ backslash

    \nnn the character whose ASCII code is nnn (octal)

    13.19 ENV- environment variables file system

    13.20 ENVIRON - RaidRunner Global environment variables - names and effects

    To over-ride the number of parity buffers for ALL raid 3's (and set only 72 parity buffers) set

    : raid ; setenv RAID3_Default_PBUFS 128
    

    If you set a default for all raid sets of a particular type, but want ONE of them to be different then set up a variable for that particular raid set as it's value will over-ride the default. In the above example, where all Raid Type 3 will have 128 parity buffers, you could set the variable

    : raid ; setenv RAID3_Dbase_PBUFS 56 
    

    which will allow the raid 3 raid set named 'Dbase' to have 56 parity buffers, but all other raid 3's defined on the RaidRunner will have 128.

    13.21 EXEC - cause arguments to be executed in place of this shell

    13.22 EXIT - exit a K9 process

    13.23 EXPR - evaluation of numeric expressions

    +

    Does nothing to expression/number to the right.

    -

    negates expression/number to the right.

    !

    logically negate expression/number to the right.

    ~

    Bitwise negate expression/number to the right.

    BINARY ARITHMETIC OPERATORS

    *

    Multiply enclosing expressions [2]

    /

    Integer division of enclosing expressions

    %

    Modulus of enclosing expressions.

    +

    Add enclosing expressions

    -

    Subtract enclosing expressions.

    <<

    Shift left expression _left_ by number in right expression. Equivalent to: left * (2 ** right)

    >>

    Shift left expression _right_ by number in right expression. Equivalent to: left / (2 ** right)

    &

    Bitwise AND of enclosing expressions

    ^

    Bitwise exclusive OR of enclosing expressions. [8]

    |

    Bitwise OR of enclosing expressions. [9]

    BINARY LOGICAL OPERATORS

    These logical operators yield the number 1 for a true comparison and 0 for a false comparison. For logical ANDs and ORs their left and right expressions are assumed to be false if 0 otherwise true. Both logical ANDs and ORs evaluate both their left and right expressions in all case (cf. C's short-circuit action).

    <=

    true when left less than or equal to right. [5]

    >=

    true when left greater than or equal to right. [5]

    <

    true when left less than right. [5]

    >

    true when left greater than right. [5]

    ==

    true when left equal to right. [6]

    !=

    true when left not equal to right. [6]

    &&

    logical AND of enclosing expressions [10]

    ||

    logical OR of enclosing expressions [11]

    ASSIGNMENT OPERATORS

    In the following descriptions "n" is an environment variable while "r_exp" is an expression to the right. All assignment operators have the same precedence which is lower than all other operators. N.B. Multiple assignment operators group right-to-left (i.e. same as C language).

    =

    Assign right expression into environment variable on left.

    *=

    n *= r_exp is equivalent to: n = n * r_exp

    /=

    n /= r_exp is equivalent to: n = n / r_exp

    %=

    n %= r_exp is equivalent to: n = n % r_exp

    +=

    n += r_exp is equivalent to: n = n + r_exp

    -=

    n -= r_exp is equivalent to: n = n - r_exp

    <<=

    n <<= r_exp is equivalent to: n = n << r_exp

    >>=

    n >>= r_exp is equivalent to: n = n >> r_exp

    &=

    n &= r_exp is equivalent to: n = n & r_exp

    |=

    n |= r_exp is equivalent to: n = n | r_exp

    13.26 GET - select one value from list

    13.27 GETIV - get the value an internal RaidRunner variable

    13.28 HELP - print a list of commands and their synopses

    13.29 HUSKY - shell for K9 kernel

    As the file "/env/status" is an environment variable the return status of a command is also available in the variable $status. The exit status of a pipeline is the exit status of the last command in the pipeline.

    This example would create the file "/d4".

    The output of another husky command or script can be made available inline by starting the sequence with "`" and finishing it with a "'". For example:

    echo {ps output follows:
    
    } `ps'
    

    This prints the string "ps output follows:" followed on the next line by the current output from the command "ps". That output from "ps" would have its embedded newlines replaced by whitespaces.

  • COMMAND LINE FILE REDIRECTION:
  • ENVIRONMENT VARIABLES: Each process can access the name it was invoked by via the variable: "arg0" . The command line arguments (excluding the invocation name) can be accessed as a list in the variable: "argv" . The number of elements in the list "argv" is place in "argc". The get command is useful for fetching individual arguments from this list. The pid of the current process can be fetched from the variable: "pid". When a script launches a new process in the background then the child's pid can be accessed from the variable "child". The variable "ContollerId" is set to the RaidRunner controller number husky is running on. Environment variables are a separate "space" for each process. Depending on the way a process was created, its initial set of environment variables may be copied from its parent process at the "spawn" point.
  • SEE ALSO: intro
  • 13.30 HWCONF - print various hardware configuration details

    13.31 HWMON - monitoring daemon for temperature, fans, PSUs.

    Certain out-of-band occurrences can be considered to be catastrophic, meaning if the occurrence remains uncorrected, the RaidRunner's hardware is likely to be damaged. Occurrences such as total fan failure and sustained high temperature along with total or partial fan failure are considered as catastrophic. hwmon has a means of automatically placing the RaidRunner into a "shutdown" or quiescent state where minimal power is consumed (and hence less heat is generated). This is done by the execution of the shutdown command after a period of time where catastrophic out-of-band occurrences are sustained. This process is enabled, via the AutoShutdownSecs internal variable. See the internals manual for use of this variable. hwmon can be prevented from starting at boot time by creating the global environment variable NoHwmon and setting any value to it. A warning message will be stored in the syslog.

    13.32 INTERNALS - Internal variables used by RaidRunner to change dynamics of running kernel

    13.33 KILL - send a signal to the nominated process

    hup - hangup [1]

    int - interrupt (rubout) [2]

    quit - quit (ASCII FS) [3]

    kill - kill (cannot be caught or ignored) [4]

    pipe - write on a pipe with no one to read it [5]

    alrm - alarm clock [6]

    term - software termination signal [7]

    cld - child process has changed state [8]

    nomem - could not obtain memory (from heap) [9]

    You cannot kill processes whose process id is between 0 and 5 inclusive. These are considered sacrosanct - hyena, init and console reader/writers.

    13.34 LED- turn on/off LED's on RaidRunner

    Different models of RaidRunner have various differences in number of LED's and their functionality. Depending on the type of LED, the ok, faulty, warning and rebuild functions perform different functions. See your RaidRunner's Hardware Reference manual to see what LED's exist and what different functions do.

  • NOTES: Tracing activities can only occur on the `onboard` leds (LED1, LED2).
  • SEE ALSO: lflash
  • 13.35 LFLASH- flash a led on RaidRunner

    led2 - LED2 on the RaidRunner controller itself

    Dc.s.l - Device on channel c, scsi id s, scsi lun l

    status - the status LED on the RaidRunner

    io - the io LED on the RaidRunner

    13.36 LINE - copies one line of standard input to standard output

    13.37 LLENGTH - return the number of elements in the given list

    13.38 LOG - like zero with additional logging of accesses

  • SEE ALSO: zero
  • 13.39 LRANGE - extract a range of elements from the given list

    13.40 LS - list the files in a directory

    13.41 LSEARCH - find the a pattern in a list

    13.42 LSUBSTR - replace a character in all elements of a list

    13.43 MEM - memory mapped file (system)

    13.44 MDEBUG - exercise and display statistics about memory allocation

    The first line indicates the debug mode, either off, on or trace. The second line indicates the number times a request for memory is made (to Mmalloc() or Mcalloc() and related functions) and the number of times the memory allocator is called to free memory (via Mfree()). The difference between these first two numbers is the total number of currently allocated blocks of memory, with the number between the '(' and ')' being the total memory requested. Note that the amount of memory actually assign may be more than requested.

    The third line indicates the amount of memory being managed. The second number is the total memory man aged (i.e. left over after loading the statically allocated text, data and bss space). The first number is that left over after various memory allocation tables have been subtracted out from that afore mention number. The fourth line is the total amount of extra memory assigned to requests in excess of the actual requested memory as compared with the totals on line 3.

    The fifth line relates to the list of currently allocated memory. The first number is the number of free entries left and the second is the maximum table size. Note that the number of currently allocated blocks (third number on line 2) when added to the first number on line 5 gives the second number on line 5.

  • OPTIONS:
  • The above three options can generate copious output and require a detailed knowledge of the source to understand their meaning.

  • off: Turns off memory allocation debugging. This is the default condition after booting.
  • on: Turns on memory allocation assertion checking.
  • trace: Turns on memory allocation assertion checking and traces every memory allocation / deallocation.
  • m: Uses Mmalloc() to allocate a block of memory of size bytes.
  • f: Uses Mfree() to de-allocate a block of memory addressed by ptr.
  • c: Uses Mcalloc() to allocate a contiguous block of memory consisting of nel elements each of size bytes.
  • r: Uses Mrealloc() to re-allocate a block of previously allocated memory, ptr, changing the allocated size to be size bytes.
  • SEE ALSO: Unix man pages on malloc()
  • 13.45 MKDIR - create directory (or directories)

    13.46 MKDISKFS - script to create a disk filesystem

  • SEE ALSO: rconf, scsihdfs
  • 13.47 MKHOSTFS - script to create a host port filesystem

    13.48 MKRAID - script to create a raid given a line of output of rconf

    13.49 MKRAIDFS - script to create a raid filesystem

  • SEE ALSO: rconf, mkraidfs, mkhostfs, mkdiskfs, raid[0135]fs
  • 13.50 MKSMON - script to start the scsi monitor daemon smon

  • SEE ALSO: smon, mconf, mkhostfs, fifofs
  • 13.51 MKSTARGD - script to initialize a scsi target daemon for a given raid set

    13.52 MSTARGD - monitor for stargd

    13.53 NICE - Change the K9 run-queue priority of a K9 process

    13.54 NULL- file to throw away output in

  • SEE ALSO zero, log
  • 13.55 PARACC - display information about hardware parity accelerator

    All other lines are only informative for debugging purposes. If there is no accelerator present, then the Parity Memory available will be 0.

    13.56 PEDIT - Display/modify SCSI backend Mode Parameters Pages

    0x2 DISCONNECT page

    0x3 FORMAT page

    0x4 GEOMETRY page

    0x8 CACHE page

    0xc NOTCH page

    0xa CONTROL page

  • SEE ALSO: The mode sense page references in the relevant product manual for the disks used in the RAID.
  • 13.57 PIPE - two way interprocess communication

    13.58 PRANKS - print or set the accessible backend ranks for the current controller

    13.59 PRINTENV - print one or all GLOBAL environment variables

    It is an error to write to the second level directory file "status". A signal number or signal name (see kill for a list of signal names - which cannot be abbreviated in this case) may be written to the file "signal". This action will send a signal to the associated process. If a signal number or name is written to the file "sigpgrp" then all the processes in the process group which this process belongs to will receive the signal.

  • SEE ALSO: ps, kill
  • 13.60 PS - report process status

    13.61 PSCSIRES - print SCSI-2 reservation table for all or specific monikers

    13.62 PSTATUS - print the values of hardware status registers

    13.63 RAIDACTION- script to gather/reset stats or stop/start a raid set's stargd

    13.64 RAID0 - raid 0 device

  • DESCRIPTION: raid0 implements a raid 0 device. It has 1 "frontend" (i.e. bind_point/data) and typically multiple "backends" (i.e. one defined by each "engage" message with a new drive number). To associate an internal name (or moniker) with the raid device, send the message "moniker name=internal_name" to the device's control file, bind_point/ctl. This implementation of raid 0 uses nbackends files in its backend. Read and write operations to the frontend (i.e. bind_point/data) must be in integral units of blockSize. Each write of blockSize bytes is written on 1 backend file. The backend "files" referred to here will typically be disks. The name argument allows associates the given backendname string with the appropriate backend. This string will be used in reporting errors on the running raid.
  • The queueLen argument must be 1 or greater and sets the maximum number of requests that can be put in a queue associated with each backend file. A daemon is spawned for each backend file to service this queue called async_io. Each backend file first needs to be identified to the raid0 device via the "engage" string sent to bind_point/ctl. If required a file can have its association with this device terminated with a "disengage" string. Once a backend file is engaged its access level can be varied between "read-write", "read-only", "write-only" and "offline" as required. The default is "offline" so in most initialization situations an "access read-write" string needs to be sent to this device. When the file bind_point/ctl is read then a line is output for every engaged backend file indicating its access status (e.g. "drive 3: engaged, read-write"). Also backend files that have been disengaged and not "re-"engaged output a line (e.g. "drive 5: disengaged").

    When the file bind_point/stats is read then a line is output which shows the cumulative number of reads and writes performed (including failures) for each backend of the raid device. The format of this line is D0 r0_cnt r0_fails w0_cnt w0_fails; D1 r1_cnt r1_fails w1_cnt w1_fails; ... which indicates that backend 0 (typically the drive0) has made r0_cnt reads, w0_cnt writes, r0_fails read failures and w0_fails write failures and that backend 1 (drive 1) has made r1_cnt reads, w1_cnt writes, r1_fails read failures and w1_fails write failures and so forth for each backend in the raid set.

    If the string "zerostats" is written to the file bind_point/stats then all cumulative read and write counts for each backend of the raid set are zeroed.

    This example creates the file "/raid0" as a bind point and then binds the raid0 device on it. The first echo command establishes the internal raid device name as R_0. The subsequent echo commands are shown in pairs for each backend file: one sending an "engage" string and the other sending an "access" string to the file "/raid0/ctl". Each "engage" string associates a backend file (via file descriptor 7) with a block size of 8192 bytes and a maximum queue length of 8. The following "access" string adjusts the access level of the backend file from "offline" (the default) to "read-write". This is a six disk raid set.

  • NOTES: The size of the resultant raid set will be the size of the smallest backend multiplied by the number of data backends adjusted downwards to align to be a multiple of the raid set's blocksize (blockSize).
  • SEE ALSO: raid1, raid3, raid4, raid5
  • 13.65 RAID1 - raid 1 device

  • DESCRIPTION: raid1 implements a raid 1 device. Raid 1 is also known as "mirroring". It has 1 "frontend" (i.e. bind_point/data) and 2 "backends" (i.e. one defined by each "engage" message with a new drive number). To associate an internal name (or moniker) with the raid device, send the message "moniker name=internal_name" to the device's control file, bind_point/ctl. Read and write operations to the frontend (i.e. bind_point/data) must be in integral units of blockSize. Each write of blockSize bytes is written on both backend files. A read of blockSize bytes needs only to read 1 backend file (unless there is a problem). The backend file chosen to do the read is the one calculated to have its heads closer to the required block. The backend "files" referred to here will typically be disks.
  • The "logical" block size is currently 512 bytes and the given blockSize must be a power of 2 times 512 (i.e. 2**n * 512 bytes). If, for example, the blockSize was 8 Kb then a write of 8 Kb would cause both backend files to have that 8 Kb written to them. An 8 Kb read would cause the file calculated to have its "heads" closer to be read. If this file was marked "offline", "write-only" or reported an IO error then the other file would be read.

    The queueLen argument must be 1 or greater and sets the maximum number of requests that can be put in a queue associated with each backend file. A daemon is spawned for each backend file to service this queue called async_io. The name argument allows associates the given backendname string with the appropriate backend. This string will be used in reporting errors on the running raid.

    Each backend file first needs to be identified to the raid1 device via the "engage" string sent to bind_point/ctl. If required a file can have its association with this device terminated with a "disengage" string. Once a backend file is engaged its access level can be varied between "read-write", "read-only", "write-only" and "offline" as required. The default is "offline" so in most initialization situations an "access read-write" string needs to be sent to this device.

    When the file bind_point/ctl is read then a line is output for every engaged backend file indicating its access status (e.g. "drive 3: engaged, read-write"). Also backend files that have been disengaged and not "re-"engaged output a line (e.g. "drive 5: disengaged").

    When the file bind_point/stats is read then a line is output which shows the cumulative number of reads and writes performed (including failures) for each backend of the raid device. The format of this line is:

    D0 r0_cnt r0_fails w0_cnt w0_fails; D1 r1_cnt r1_fails w1_cnt w1_fails;
    

    which indicates that backend 0 (typically the drive0) has made r0_cnt reads, w0_cnt writes, r0_fails read failures and w0_fails write failures and that backend 1 (drive 1) has made r1_cnt reads, w1_cnt writes, r1_fails read failures and w1_fails write failures.

    If the string "zerostats" is written to the file bind_point/stats then all cumulative read and write counts for each backend of the raid set are zeroed.

    This example creates the file "/raid1" as a bind point and then binds the raid1 device on it. The first echo command

    establishes the internal raid device name as R_1. The subsequent echo commands are shown in pairs for both backend files: one sending an "engage" string and the other sending an "access" string to the file "/raid1/ctl". Each "engage" string associates a backend file (via file descriptor 7) with a block size of 8192 bytes and a maximum queue length of 8. The following "access" string adjusts the access level of the backend file from "offline" (the default) to "read-write".

  • NOTES: The size of the resultant raid set will be the size of the smallest backend multiplied by the number of data backends (here just 1 as we are a mirror) adjusted downwards to align to be a multiple of the raid set's blocksize (blockSize).
  • SEE ALSO: raid0, raid3, raid4, raid5
  • 13.66 RAID3 - raid 3 device

  • DESCRIPTION: raid3 implements a raid 3 device. It has 1 "frontend" (i.e. bind_point/data) and typically multiple "backends" (i.e. one defined by each "engage" message with a new drive number).
  • To associate an internal name (or moniker) with the raid device, send the message "moniker name=internal_name" to the device's control file, bind_point/ctl.

    This implementation of raid 3 uses at least 3 files in its backend. Read and write operations to the frontend (i.e. bind_point/data) must be in integral units of blockSize. Each write of blockSize bytes is striped (i.e. divided evenly) across (nbackends - 1) files with the "parity" on the other file. Subsequent writes will NOT rotate the file being used to store parity. [This rotation is a slight extension of the original raid 3 definition.] The backend "files" referred to here will typically be disks.

    The "logical" block size is currently 512 bytes and the given blockSize must be an integral multiple of (nbackends - 1) * 512 If, for example, the blockSize was 8 Kb and there were 5 backends then a write of 8 Kb would cause 4 backend files to have 2 Kb written on them and the other backend file to have 2 Kb of parity written on it. An 8 Kb read would cause the 4 files known to hold the data (as distinct from the parity) to be read. If any one of these files was marked "offline", "write-only" or reported an IO error then the 5th file containing the parity would be read and the 8 Kb block reconstructed.

    The queueLen argument must be 1 or greater and sets the maximum number of requests that can be put in a queue associated with each backend file. A daemon is spawned for each backend file to service this queue called async_io.

    The name argument allows associates the given backe