>> As there was no immediate interest im a kosher "superblock" command,
>> I HACKed together a perl script to do the business (save SB to file,
>> write SB from file, set datestamps, manipulate disk states, etc) which
>> does indeed include the ability to generate /etc/raidtab entries ...
> That would be worth seeing...

http://www.cl.cam.ac.uk/~pb/sb tempoararily holds the documentation I'm
writing for it -- but we have the power off tomorrow, so it won't be readable.
Here's the basics ... I really quite like "-d/-e" ... very useful.


   This describes a perl script to investigate which operations might be
   useful for managing Linux RAID systems by operating on the
   superblocks.

   It reads, displays and writes RAID `superblocks', as used in
   raidtools.

   As well as accessing the copy at the end of the raw disk partition, it
   can also use copies in files, either in raw format, or in `od -t x4'
   format (allowing the use of simple text editors).

   It can display the data for human consumption, but also generate
   /etc/raidtab format.

   The superblocks to be processed can be given on the command line
   explicitly (e.g. sdc3, /dev/sdc3 or SB-sdc3-921939090), indirectly
   (e.g. md3 or /dev/md3), or by giving a flag to tell it how to find
   suitable disks (e.g. -p).

   When processing multiple arguments, it suppresses duplicates, and so
   long as the different component superblocks agree, suppresses
   duplicates.

   Note that operations which write to a raw partition will normally have
   no effect if used on a started partition, as stopping the partition
   causes the superblock to be re-written.

   The options to specify which superblock to process are:
   -p
          (default) process currently started devices, by inspecting
          /proc/mdstat
   -T
          process all devices mentioned in /etc/raidtab
   -F
          process all devices listed by `fdisk -l' as being of type 0xFD
   -f
          process all devices listed by `fdisk -l'
   -a
          process a set of devices listed in the script

   The options to specify how to display the data are:
   -i
          (default) Display information for human consumption. It's
          cryptic, so have a copy of the .h file nearby ...
   -t
          generate output suitable for use in /etc/raidtab
   -r file
          read from the superblock and write it to the named file.
          The filename will be given to sprintf, with arguments of the
          device name (e.g. sdc3) and the time (e.g. 921939090), allowing
          the generation of
   -w file
          write to the superblock data read from the named file.
          The filename will be given to sprintf, with arguments of the
          device name (e.g. sdc3).
          It needs an additional flag to tell the command whether to
          check that the superblock was previously `good', or that it was
          previously `corrupt'. When run without either flag, it says
          which one is appropriate.
          If no -r option is given, it will save the old data in a file
          called raid-sb- If no safety copy is wanted, use `-r
          /dev/null'.
   -d
          disable a partition's superblock by XORing the `magic number'
          with 0x33 (changing it from 0xa92b4efc to 0xa92b4ecf) so that
          the kernel does not `see' the superblock.
   -e
          enable a partition's superblock by XORing the `magic number'
          with 0x33 (changing it back from 0xa92b4ecf to 0xa92b4efc)
          after an earlier disable, so that the kernel one again `see's
          the superblock.

   The options to specify how to process things are:
   -v
          raise the verbosity to show what is being attempted.
   -X
          When writing data to file, use hex format, similar to `od -t
          x4', which allows easy editing, and is usually compact, as most
          of the superblock is zeros.
   -A
          Normally if a user supplied argument is of the form md* or
          /dev/md*, the script tries to find the base devices by
          inspecting /proc/mdstat and /etc/raidtab. This flag suppresses
          this processing, and reads the raid device for a superblock
          i.e. for recursive RAID mounts (e.g. mirrored striped disks).

Reply via email to