Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 23437 - baselayout checkfs should support mdadm and LVM over md
Summary: baselayout checkfs should support mdadm and LVM over md
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-25 00:17 UTC by Rex Walters
Modified: 2003-07-19 16:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to checkfs version 1.23 (checkfs.patch,2.64 KB, patch)
2003-06-25 00:17 UTC, Rex Walters
Details | Diff
Patch to checkfs 1.23 to add mdadm support (checkfs.patch,2.46 KB, patch)
2003-07-17 10:21 UTC, Wes Kurdziolek
Details | Diff
Patch to checkfs 1.23 to add mdadm support (checkfs.patch,2.46 KB, patch)
2003-07-17 10:21 UTC, Wes Kurdziolek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rex Walters 2003-06-25 00:17:12 UTC
For various reasons I've decided to use mdadm instead of raidtools to manage my
md configuration -- i.e. no /etc/raidtools. [See
http://linux.oreillynet.com/pub/a/linux/2002/12/05/RAID.html ]

The gentoo startup scripts (specifically /etc/init.d/checkfs) won't start up
your raid sets unless you are using raidtools.

Worse, because checkfs scans for LVM volume groups before it starts raid, there
is no way to build LVM LVs on top of software raid arrays -- vgscan can't find
anything until the arrays are started.

I think the attached patch should fix both problems.  I haven't actually tested
this patch yet (I'll attach it as soon as I  submit this bug -- I'll update the
bug with the results).  I'm currently running with a separate checkfs.msadm
script but this required hacking /sbin/rc and /etc/init.d/localmount which call
checkfs.

Reproducible: Always
Steps to Reproduce:
1. Use mdadm to create raid arrays /dev/md/* and make them PVs
2. Create LVs on top of these raid arrays
3. Try to boot

Actual Results:  
No filesystems built on LVs get mounted (in my case this means no /usr, /var,
/tmp, /home, or /music).

Expected Results:  
Everything should get assembled and mounted fine.

Portage 2.0.48-r1 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1)
=================================================================
System uname: 2.4.20-ck6 i686 AMD Athlon(tm) XP 1900+
GENTOO_MIRRORS="rsync://203.16.234.20/pub/gentoo/
ftp://ftp.ussg.iu.edu/pub/linux/gentoo
http://csociety-ftp.ecn.purdue.edu/pub/gentoo/
ftp://csociety-ftp.ecn.purdue.edu/pub/gentoo/
ftp://mirror.iawnet.sandia.gov/pub/gentoo/"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY=""
USE="x86 oss apm avi encode libg++ mikmod mmx mpeg nls quicktime spell xml2 xmms
xv gdbm berkdb slang readline tetex svga tcltk java guile sdl tcpd pam esd imlib
qt motif 3dfx 3dnow aalib alsa -arts bonobo cdr crypt cups doc fbcon gd gif
gnome gpm gtk imap jpeg -kde libwww maildir mozilla mysql ncurses oggvorbis
opengl pcmcia pdflib perl plotutils png python samba ssl truetype usb voodoo3
wavelan X xml zlib"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O3 -pipe"
CXXFLAGS="-march=athlon-xp -O3 -pipe"
ACCEPT_KEYWORDS="x86 ~x86"
MAKEOPTS="-j2"
AUTOCLEAN="yes"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
FEATURES="sandbox ccache"
Comment 1 Rex Walters 2003-06-25 00:17:53 UTC
Created attachment 13817 [details, diff]
patch to checkfs version 1.23
Comment 2 Rex Walters 2003-06-25 00:29:46 UTC
I just applied the patch to checkfs and rebooted successfully:

rex@megrims rex $ mount
/dev/root on / type reiserfs (rw,noatime)
none on /proc type proc (rw)
none on /dev type devfs (rw)
/dev/raid0vg/oslv on /usr type reiserfs (rw,noatime)
/dev/raid0vg/varlv on /var type reiserfs (rw,noatime)
/dev/raid0vg/optlv on /opt type reiserfs (rw,noatime)
/dev/raid0vg/homelv on /home type reiserfs (rw)
/dev/raid0vg/tmplv on /tmp type reiserfs (rw,noatime)
/dev/raid0vg/ogglv on /music type reiserfs (rw,noatime)
none on /dev/shm type tmpfs (rw)
none on /proc/bus/usb type usbfs (rw)


[/boot is on /dev/hda1 and root is on /dev/hda5.  I backup /boot with "dd if=/dev/hda1 of=/dev/hdb1 bs=8192b", and I backup most everything else with simple find/cpio scripts to normally unmounted filesystems on raid1 (mirrored) volumes.]
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-06-30 14:35:46 UTC
No go sorry.  Various people have raid volumes on lvm, and it is pretty much
the order that others do it.

Also, various patches in the past was suggested, sorda confirmed as working,
and when the problems hit the fan, nobody was there to fix it (and as I do
not use/able to use raid ....).

If it maybe checked for mdadm if no raidtab existed, sure.  If it could
work out if it should first raid, or lvm, fine.  But just changing because of
one report, and then totally dropping md support for mdadm is not good practise.
Comment 4 Rex Walters 2003-06-30 16:52:45 UTC
> and when the problems hit the fan, nobody was there to fix it ...

Sorry there was no-one around when things "hit the fan", but I'm pretty new to gentoo.  Wish I'd been here to help.

> If it maybe checked for mdadm if no raidtab existed, sure.  

Hmm... Well, my patch pretty much does the demorgan equivalent.

If you look at the patch you'll see that I put in at least similar logic.  The difference is that my code uses mdadm if it's present then raidtab if not.  I've no problem with changing the logic to go the other way round (use raidtab if present, otherwise mdadm) -- same end result unless both are installed and configured.


> If it could
> work out if it should first raid, or lvm, fine.  But just changing because of
> one report, and then totally dropping md support for mdadm is not good 
> practise.

I'm not sure I understand what you mean about dropping md support.

md itself is a kernel thing with two (three actually if you include evms) separate ways of administering it from userspace: raidtools and mdadm.  Raidtools is older and probably more common, but mdadm has been gaining in popularity (witness recent traffic on the linux-raid and linux-kernel mailing list).

I'd really like checkfs to support mdadm AS WELL AS raidtools (not in place of it).  If you'd like me to submit a separate patch that ONLY adds support for mdadm, just say so -- I can guarantee that it won't affect checkfs at all unless you explicitly emerge and configure mdadm.

Finally, I've no idea how anybody is succesfully creating an LVM volume group comprised of md raid-sets with the existing checkfs.  Clearly vgscan is run before raidstart -- how can it possibly find /dev/md* if they haven't been created yet?

Even if you decide not to include mdadm support, I really think the existing ordering is a flat-out bug that should be corrected.

My patch as submitted makes two changes:

1) Starts raid (/dev/md*) before starting LVM (vgscan)

2) Starts up raid if configured with mdadm if present and configured, or with raidtools if mdadm isn't.

Both of these seem like pretty reasonable changes to me, but I'm certainly amenable to changing the logic for 2 to use raidtools if both are installed.

I'm also willing to put together a test suite to verify everything still works with different combinations of lvm/mdadm/raidtools/evms if you like (though it will likely take me at least several weeks).

Regards,
-- 
Rex



Comment 5 Wes Kurdziolek 2003-07-17 10:21:29 UTC
Created attachment 14626 [details, diff]
Patch to checkfs 1.23 to add mdadm support

Here's a patch to checkfs 1.23 which adds mdadm support to checkfs in addition
to the existing raidtools support. I've tested it on my machine, and it works
fine. It's basically a duplication of the raidtools part w/ changes to which
commands to run.
Comment 6 Wes Kurdziolek 2003-07-17 10:21:59 UTC
Created attachment 14627 [details, diff]
Patch to checkfs 1.23 to add mdadm support
Comment 7 Wes Kurdziolek 2003-07-17 10:23:33 UTC
Sorry for the double attach. BugZilla threw me an error, and I didn't realize that the attach had gone threw anyway.
Comment 8 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-17 11:39:51 UTC
Looks good.  Added to CVS, new baselayout in a day or so, thanks.
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2003-07-19 16:16:13 UTC
Wes, sorry about the credits that I got wrong, it was late :-).  Anyhow, it
is fixed in CVS now.