[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] Getting LVM to startup on RedHat

> to touch NT with a 10' pole as a server.

closer than i'd get :-)

> To get LVM working, I ended up specifying noauto in the fstab. vgscan and
> vgchange -ay don't seem to work when placed before mounting of filesystems
> as directed in the HowTO, but will work if placed at the end of rc.sysinit.
> On the downside, I had to hardcode the mount of the LVM filesystem.

bit of a hack but:

	/etc/fstab has noauto for all of the lvm file systems, your
	volume groups all have "/vg" in them (e.g., /dev/vg00) [sue
	me, i've spent 10+ years running HP systems].


	/usr/bin/perl -n -a -e 'print STDERR qx(mount $F[0]) if m{/vg}'

i.e., reading every line in /etc/fstab with out printing it (-n) 
and splitting all the fields on whitespace (-a) print the result
of "mount" for the first autosplit field ($F[0]) tp stderr if the
line we just read contains "/vg" (m{/vg}) for all the lines in


	BEGIN{$|=1; print qx(/sbin/vgchange -a -y)} 

i.e., flush lines on output and run the vgchange beforehand,
and you get a one-liner to activate LVM and mount the volumes.

which looks like:

/usr/bin/perl -n -a \
-e '
		$| = 1;
		print qx( /sbin/vgchange -a -y );

	print qx( mount $F[0] if m{/vg} )
' /dev/fstab;

if you want it prettified.

cute thing is that you can re-run this as useful since both
the vgchange and mount will fail harmlessly for already active
or mounted systems.


 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark wrkhors com                                   800-762-1582

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]