Linux LVM users
 help / color / mirror / Atom feed
* [linux-lvm] Patch for Miguel Cabeca's lvm2create_initrd script
@ 2004-03-10 20:19 Jeff Layton
  2004-03-11  9:39 ` Jeffrey Layton
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2004-03-10 20:19 UTC (permalink / raw)
  To: linux-lvm

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

Ok -- I think I have it now (for real this time :-). I've overhauled the
mechanism for cleaning up device entries:

1) we first remove /rootvol/dev/mapper
2) mknod a /rootvol/dev/mapper/control device file
3) chroot to /rootvol, mount /proc, run /sbin/vgmknodes, and umount
/proc

This should make all the correct device entries and vg symlinks under
/dev, and should allow the initrd images to cope with the renumbering of
major/minor numbers, as I've found sometimes happens on kernel upgrades.

Attached is a patch to Miguel's original script. The current one is
available from:

http://poochiereds.net/svn/lvm2create_initrd

As always, comments and/or patches are welcome.
-- 
Jeff Layton <jtlayton@poochiereds.net>

[-- Attachment #2: lvm2create_initrd.patch --]
[-- Type: text/x-patch, Size: 1229 bytes --]

Index: lvm2create_initrd.sh
===================================================================
--- lvm2create_initrd.sh	(revision 70)
+++ lvm2create_initrd.sh	(working copy)
@@ -77,7 +77,7 @@
 
 # include in the path some dirs from the real root filesystem
 # for chroot, blockdev
-PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200"
+PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200:/initrd/bin:/initrd/sbin"
 PRE="initrd:"
 
 echo "$PRE Remounting / read/write"
@@ -144,6 +144,26 @@
 echo "$PRE Umounting /proc"
 umount /proc
 
+# make /rootvol/proc if it doesn't exist
+if [ ! -d /rootvol/proc ]; then
+    mkdir /rootvol/proc
+fi
+ 
+# remove old /dev/mapper directory
+echo "$PRE Removing old /dev/mapper directory on $rootvol"
+rm -rf /rootvol/dev/mapper
+ 
+# create /dev/mapper/control device on /rootvol
+if test -n "$MAJOR" -a -n "$MINOR" ; then
+    echo "$PRE Creating /dev/mapper/control device on $rootvol"
+    mkdir -p -m 755 /rootvol/dev/mapper
+    mknod -m 600 /rootvol/dev/mapper/control c $MAJOR $MINOR
+fi
+ 
+echo "$PRE Creating LVM2 devices on $rootvol"
+cd /rootvol
+( chroot . sh -c 'mount -t proc none /proc; /sbin/vgmknodes; umount /proc' )
+ 
 echo "$PRE Changing roots"
 cd /rootvol
 mkdir -p initrd

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

* Re: [linux-lvm] Patch for Miguel Cabeca's lvm2create_initrd script
  2004-03-10 20:19 [linux-lvm] Patch for Miguel Cabeca's lvm2create_initrd script Jeff Layton
@ 2004-03-11  9:39 ` Jeffrey Layton
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey Layton @ 2004-03-11  9:39 UTC (permalink / raw)
  To: linux-lvm

On Wed, 2004-03-10 at 20:21, Jeff Layton wrote:
> Ok -- I think I have it now (for real this time :-). I've overhauled the
> mechanism for cleaning up device entries:
> 
> 1) we first remove /rootvol/dev/mapper
> 2) mknod a /rootvol/dev/mapper/control device file
> 3) chroot to /rootvol, mount /proc, run /sbin/vgmknodes, and umount
> /proc
> 
> This should make all the correct device entries and vg symlinks under
> /dev, and should allow the initrd images to cope with the renumbering of
> major/minor numbers, as I've found sometimes happens on kernel upgrades.
> 
> Attached is a patch to Miguel's original script. The current one is
> available from:
> 
> http://poochiereds.net/svn/lvm2create_initrd
> 
> As always, comments and/or patches are welcome.

Alas, I think I've solved this problem in the wrong place. The real
problem is that the LVM startup script on Debian that runs prior to the
mountall script doesn't add the --mknodes flag when it runs vgscan.

I think that's the correct place to have it fix the device entries. I'm
working with the maintainer of the lvm-common debian package now to see
if we can get the fix rolled into their package.

So the only change that should be needed to Miguel's script is to add
/initrd entries to the PATH.

Cheers,
Jeff

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

end of thread, other threads:[~2004-03-11 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-10 20:19 [linux-lvm] Patch for Miguel Cabeca's lvm2create_initrd script Jeff Layton
2004-03-11  9:39 ` Jeffrey Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox