linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* announce: tiny raidtools-alike for use e.g. in initrd
@ 2003-10-30  7:25 Michael Tokarev
  2003-10-31  8:43 ` Luca Berra
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2003-10-30  7:25 UTC (permalink / raw)
  To: linux-raid

http://www.corpit.ru/mjt/mdctl.c - a very small utility similar
to raidtools suite.  I wrote this program to use it inside an
initrd to bring raid arrays up at boot time - where the size of
executable and simplicity is at premium.  Differences between this
implementation and raidtools are:

  - size.  When compiled with dietlibc, executable is about
    7kb on i386.

  - it does not have mkraid utility and other fun stuff.
    Supported are
    - raidstart
    - raidstop
    - raidhot{add,remove,generateerror)
    - raidsetfaulty
   i.e., only "simple" commands - just ioctls in fact.

  - it uses NO config file like all the raidtools suite.
    I.e., it is more like mdadm in this respect.  All
    parameters are accepted in the command line.  This
    makes the utility handy inside read-only boot-time
    environment (you may e.g. parse md=... kernel
    parameter and convert it into mdctl commandline)

  - `mdctl start' tries to bring an array using ALL components
    of the array given in the command line, until successeful
    (raidstart tries only first component, and if that is missing
    but other component(s) are available, operation will fail).

Usage:

  mdctl start /dev/mdN /dev/hda1 /dev/hdb1 /dev/hdc1
    equivalent to md=N,/dev/hda1,/dev/hdb1,/dev/hdc1 boot
    parameter, but you can't specify raid level (it will
    be read from the superblock), and kernel may choose to
    bring up another mdN (as indicated by super-minor)

  mdctl {stop,readonly,ro,readwrite,rw} /dev/mdN

  mdctl {add,remove,setfaulty,generaterror} /dev/mdN /dev/hda1

This tiny code released under GPL licence... in a hope it will
be useful to someone else too, not only to me ;)

Enjoy.

/mjt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: announce: tiny raidtools-alike for use e.g. in initrd
  2003-10-30  7:25 announce: tiny raidtools-alike for use e.g. in initrd Michael Tokarev
@ 2003-10-31  8:43 ` Luca Berra
  2003-10-31  9:16   ` Luca Berra
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Berra @ 2003-10-31  8:43 UTC (permalink / raw)
  To: linux-raid

well, 
since it is announce week :)))

I made a small patch to mdadm to build a subset of mdadm with diet-libc,
for use in initrds. (it is 44k statically linked)

I cannot rebuild whole mdadm with dietlibc due to dietlibc not
understanding non option arguments beetween option (optarg starting
with "-")

to build use:
diet gcc -DCONFFILE="\"/etc/mdadm.conf\"" -o mdassemble \
        mdassemble.c Assemble.c config.c dlink.c util.c

mdassemble will just scan /etc/mdadm.conf and try to assemble everything
it finds like running "mdadm -A -s".

regards,
L.


-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: announce: tiny raidtools-alike for use e.g. in initrd
  2003-10-31  8:43 ` Luca Berra
@ 2003-10-31  9:16   ` Luca Berra
  0 siblings, 0 replies; 3+ messages in thread
From: Luca Berra @ 2003-10-31  9:16 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

/me should drink more coffee in the morning
heres the patch: (it is vs 1.3.0, but it applies on 1.4.0 as well)

On Fri, Oct 31, 2003 at 09:43:21AM +0100, Luca Berra wrote:
>well, 
>since it is announce week :)))
>
>I made a small patch to mdadm to build a subset of mdadm with diet-libc,
>for use in initrds. (it is 44k statically linked)
>
>I cannot rebuild whole mdadm with dietlibc due to dietlibc not
>understanding non option arguments beetween option (optarg starting
>with "-")
>
>to build use:
>diet gcc -DCONFFILE="\"/etc/mdadm.conf\"" -o mdassemble \
>        mdassemble.c Assemble.c config.c dlink.c util.c
>
>mdassemble will just scan /etc/mdadm.conf and try to assemble everything
>it finds like running "mdadm -A -s".
>

-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \

[-- Attachment #2: mdadm-1.3.0-diet.diff.bz2 --]
[-- Type: application/octet-stream, Size: 2000 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-31  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-30  7:25 announce: tiny raidtools-alike for use e.g. in initrd Michael Tokarev
2003-10-31  8:43 ` Luca Berra
2003-10-31  9:16   ` Luca Berra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).