From: Les Hazelton <seawolf@attglobal.net>
To: linux-lvm@sistina.com
Subject: Re: [linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me
Date: Fri, 12 Jan 2001 22:51:14 -0500 [thread overview]
Message-ID: <3A5FD0B2.89C1E815@attglobal.net> (raw)
In-Reply-To: 200101130054.f0D0s9C32510@webber.adilger.net
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
Andreas Dilger wrote:
> Is it possible you are running out of inodes on the ram disk? You can
This is the obviously the reason for the problem. I did a scan of /dev
using [ls /dev | grep -c ""] which produced a number 6261. There are a
huge number if ISDN related entries in /dev. I need to look at removing
them since I don't use ISDN.
> - call the ramdisk initrd-lvm-$VERSION.gz to allow multiple ramdisk
I really like the new name - saves me from changing it by hand ;-)
> Cheers, Andreas
The new lvmcreate_initrd you posted got me running - with a few changes.
I had to shift to the mke2fs command with the -N parm as you suggested.
Even with the -N parm I was still having problems so I rebooted the
system with a 12288k ram disk size and adjusted the script accordingly.
That got everything working.
I also made a change - for testing - so I could see the generated mke2fs
command. I have attached the script as I used it. Thanks for the help.
--
Good Journey, longevity and prosperity to all
Les Hazelton
[-- Attachment #2: lvm-initrd --]
[-- Type: text/plain, Size: 5919 bytes --]
#!/bin/sh
#
# Copyright (C) 1997 - 2000 Heinz Mauelshagen, Sistina Software
#
# June 1999
# December 1999
# January 2000
# January 2001
#
# LVM is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# LVM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LVM; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
#
# Changelog
#
# 16/11/1999 - corrected -N type with mke2fs
# 19/12/1999 - use correct ramdisk size, strip shared library to save space
# 04/01/2000 - support /proc mount, because lvm_dir_cache now uses it
# 01/12/2001 - always create enough inodes in ramdisk for new files
# [AED] - don't try to copy LVM module if LVM is compiled into kernel
# - check all INITRDFILES for library dependencies
# - make commands quiet and avoid redirecting errors to /dev/null
# - use cleanup function for all errors, interrupts, normal exit
#
cmd=`basename $0`
VERSION=$1
[ -z "$VERSION" ] && VERSION=`uname -r`
DEVRAM=/tmp/initrd.$$
INITRD=/boot/initrd-lvm-$VERSION.gz
INITRDSIZE=12288
MODULES=/lib/modules/$VERSION
INITRDFILES="/sbin/modprobe /sbin/vgchange /sbin/vgscan /bin/bash /bin/mount /bin/umount /bin/sh /bin/rm /sbin/insmod $MODULES/modules.dep"
if [ -r $MODULES/kernel/drivers/md/lvm-mod.o ]; then
INITRDFILES="$INITRDFILES $MODULES/kernel/drivers/md/lvm-mod.o"
elif [ -r $MODULES/block/lvm-mod.o ]; then
INITRDFILES="$INITRDFILES $MODULES/block/lvm-mod.o"
elif [ -r $MODULES/block/lvm.o ]; then
INITRDFILES="$INITRDFILES $MODULES/block/lvm.o"
fi
TMPMNT=/tmp/mnt.$$
cleanup () {
[ "`mount | grep $DEVRAM`" ] && umount $DEVRAM
[ -f $DEVRAM ] && rm $DEVRAM
[ -d $TMPMNT ] && rmdir $TMPMNT
exit $1
}
trap "
echo -e 'Bye bye...\n'
cleanup 1
" 1 2 3 15
create_fstab () {
cat << FSTAB > $TMPMNT/etc/fstab
/dev/ram / ext2 defaults 0 0
proc /proc proc defaults 0 0
FSTAB
chmod 644 $TMPMNT/etc/fstab
}
create_linuxrc () {
cat << LINUXRC > $TMPMNT/linuxrc
#!/bin/sh
/sbin/modprobe lvm-mod
/bin/mount /proc
/sbin/vgscan
/sbin/vgchange -a y
/bin/umount /proc
LINUXRC
chmod 555 $TMPMNT/linuxrc
}
#
# Main
#
echo -e "\nLogical Volume Manager 0.9 by Heinz Mauelshagen 01/12/2001\n"
echo -e "$cmd -- create an LVM initial ram disk $INITRD\n"
# figure out which actual shared libraries we need in our initrd
echo "$cmd -- figuring out shared libraries"
SHLIBS=`ldd $INITRDFILES 2>/dev/null | awk '{if (/=>/) { print $3 }}' |
sort -u`
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR figuring out needed shared libraries\n"
exit 1
fi
echo "$cmd -- making ram filesystem"
dd if=/dev/zero of=$DEVRAM count=$INITRDSIZE bs=1024 >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR creating loopback file\n"
cleanup 1
fi
# We could use -N to specify the number of inodes, but this option only
# appeared in mke2fs 1.14 (Jan 1999) so we will avoid it at least for now
NUMINO="`find /dev $SHLIBS $INITRDFILES 2>/dev/null | wc -w`"
#mke2fs -q -F -m0 -N `expr $NUMINO + 64` $DEVRAM $INITRDSIZE
BYTES_PER_INODE=`expr $INITRDSIZE \* 1024 / \( $NUMINO + 64 \)`
#rnCmd="mke2fs -q -F -m0 -i $BYTES_PER_INODE $DEVRAM $INITRDSIZE"
rnCmd="mke2fs -q -F -m0 -N `expr $NUMINO + 64` $DEVRAM $INITRDSIZE"
echo "$cmd -- mke2fs command ["$rnCmd"]"
$rnCmd
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR making ram disk filesystem\n"
cleanup 1
fi
mkdir $TMPMNT
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR making $TMPMNT\n"
cleanup 1
fi
echo "$cmd -- mounting ram filesystem"
mount -oloop $DEVRAM $TMPMNT
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR mounting $DEVRAM on $TMPMNT\n"
cleanup 1
fi
mkdir $TMPMNT/etc $TMPMNT/proc
#
# create new modules configuration to avoid kmod complaining
# about nonexsisting modules.
#
MODCONF=/etc/modules.conf
[ ! -r $MODCONF -a -r /etc/conf.modules ] && MODCONF=/etc/conf.modules
echo "$cmd -- creating new $MODCONF"
MAJ=0
while [ $MAJ -lt 256 ]; do
echo "alias block-major-$MAJ off"
echo "alias char-major-$MAJ off"
MAJ=`expr $MAJ + 1`
done > $TMPMNT/$MODCONF
# to ensure, that modprobe doesn complain about timestamps
echo "$cmd -- creating new modules.dep"
depmod -a $VERSION
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR running depmod\n"
cleanup 1
fi
# copy necessary files to ram disk
echo "$cmd -- copying files to ram disk"
find $INITRDFILES /dev|cpio -pdm --quiet $TMPMNT
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR cpio to ram disk\n"
cleanup 1
fi
echo "$cmd -- copying shared libraries to ram disk"
find $SHLIBS|cpio -Lpdm --quiet $TMPMNT
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR copying needed shared libraries to ram disk\n"
cleanup 1
fi
for lib in $SHLIBS
do
strip $TMPMNT$lib >/dev/null
done
echo "$cmd -- creating new /linuxrc"
create_linuxrc
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR creating linuxrc\n"
cleanup
exit 1
fi
echo "$cmd -- creating new /etc/fstab"
create_fstab
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR creating /etc/fstab\n"
cleanup 1
fi
echo "$cmd -- ummounting ram disk"
umount $DEVRAM
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR umounting $DEVRAM\n"
cleanup 1
fi
echo "$cmd -- creating compressed initrd in $INITRD"
dd if=$DEVRAM bs=1k count=$INITRDSIZE 2>/dev/null | gzip -9 > $INITRD
if [ $? -ne 0 ]; then
echo -e "$cmd -- ERROR creating $INITRD\n"
cleanup 1
fi
cleanup 0
next prev parent reply other threads:[~2001-01-13 3:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-12 11:03 [linux-lvm] how can I init LVM on software RAID ? Jürgen Frank
2001-01-12 18:59 ` Andreas Dilger
2001-01-12 20:13 ` [linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me Les Hazelton
2001-01-12 22:10 ` Chris Worley
2001-01-13 1:07 ` Andreas Dilger
2001-01-13 0:54 ` Andreas Dilger
2001-01-13 3:51 ` Les Hazelton [this message]
[not found] ` <3A5F1C1A.5D9C8CE4@symbionsys.com>
[not found] ` <3A5F1E6C.CD1D1A3E@lxco.com>
[not found] ` <3A5F27F0.1090002@liberate.com>
2001-01-16 7:16 ` [linux-lvm] how can I init LVM on software RAID ? Jürgen Frank
[not found] ` <20010116092247.G717@66bassett.freeserve.co.uk>
2001-01-16 13:08 ` Jürgen Frank
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=3A5FD0B2.89C1E815@attglobal.net \
--to=seawolf@attglobal.net \
--cc=linux-lvm@sistina.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.