Linux LVM users
 help / color / mirror / Atom feed
From: Jeff Layton <jtlayton@poochiereds.net>
To: linux-lvm@redhat.com
Subject: [linux-lvm] Patch for Miguel Cabeca's lvm2create_initrd script
Date: Wed Mar 10 20:19:18 2004	[thread overview]
Message-ID: <1078968102.3348.20.camel@localhost> (raw)

[-- 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

             reply	other threads:[~2004-03-11  1:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10 20:19 Jeff Layton [this message]
2004-03-11  9:39 ` [linux-lvm] Patch for Miguel Cabeca's lvm2create_initrd script Jeffrey Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1078968102.3348.20.camel@localhost \
    --to=jtlayton@poochiereds.net \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox