Skip to contentSkip to conversation

how can I init LVM on software RAID ?

linux-lvm Jürgen Frank 4 participants 9 messages Jan 12, 2001 – Jan 16, 2001 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi !!

I want to create the following system :

I use the new kernel (2.4) and I want to use the software raid and the lvm,
but my problem is... how ?

I can't find a step by step documentation and all what I try don't work.

So what did I done :

* create a mirror system with software raid (last version), after this step I have a good raid system with the drive /dev/md0

* normally now I need to create a partition on the drive , but I read in the raid docu that the md-drives don't support partitions !!!

But, without a partiton of the type 0x8e I can't run vgscan and pvcreate...

So, can anyone help me ?!

Juergen

(sorry for the bad english)

#1 lore raw
Quoted 4 lines · Juergen

I want to create the following system :

I use the new kernel (2.4) and I want to use the software raid and the lvm, but my problem is... how ?

You need to patch the user tools to allow this, (patch is cut-n-paste so you will have to apply by hand).

tools/lib/pv_get_size.c Sat Dec 23 14:27:47 2000 renamed from tools/lib/pv_get_size.c.bluca.orig Sat Dec 23 11:23:30 2000 +1 -0
@@ -97,6 +97,7 @@
             if ( dir_cache[i].st_rdev == st_rdev)
                break;
          }
+         strncpy ( disk_dev_name, dir_cache[i].dev_name, sizeof (

disk_dev_name

) - 1);
       } else {
          strncpy ( disk_dev_name, dev_name, sizeof ( disk_dev_name) - 1);
       }
@@ -104,8 +105,6 @@
       ret = -LVM_EPV_GET_SIZE_LVM_DIR_CACHE;
       goto pv_get_size_end;
    }
-
-   strncpy ( disk_dev_name, dir_cache[i].dev_name, sizeof ( disk_dev_name) -
    1)

;

    first = 1;
    if ( ( pv_handle = open ( disk_dev_name, O_RDONLY)) == -1) {
Quoted 5 lines

* normally now I need to create a partition on the drive , but I read in the raid docu that the md-drives don't support partitions !!!

But, without a partiton of the type 0x8e I can't run vgscan and pvcreate...

You can run pvcreate on a whole drive, but only with the above patch.

Cheers, Andreas

Signature · 3 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
#2 lore raw

[linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me

I have been working on a problem with 0.8final - lvmcreate_initrd for the past week or so - off and on. The problem is that the step where the files are copied to the ram disk fails for lack of space even though the ram disk has about 7 meg free.

If I duplicate the commands from the command line I can create an 8 meg ram disk and fill the full 8 meg.

My system is running Mandrake 7.2 and the kernel is the source distributed by Mandrake kernel-2.2.17-21mdk patched with lvm-0.8final-2.2.16TL.patch.

As far as I can tell, everything else is working correctly. I can extend my reiserfs filesystems which are on LVs while they are on-line and in use with no identified problems. I just can't build a new initrd for a new kernel compile.

I have attached a copy of the lvmcreate_initrd output and that of a df command also.

I would appreciate any ideas on how to resolve this.

Signature · 3 lines
Good Journey, longevity and prosperity to all

Les Hazelton

[root@farpt1 /tmp]# lvmcreate_initrd

Logical Volume Manager 0.8 by Heinz Mauelshagen 11/11/1999

lvmcreate_initrd -- this script creates a LVM initial ram disk in /boot/initrd.gz

lvmcreate_initrd -- making ram filesystem
lvmcreate_initrd -- mounting ram filesystem
lvmcreate_initrd -- creating etc/conf.modules
lvmcreate_initrd -- creating new modules.dep
lvmcreate_initrd -- copying files to ram disk
find: /lib/modules/2.2.17-21mdk-01/block/lvm.o: No such file or directory lvmcreate_initrd -- figuring out shared libraries lvmcreate_initrd -- copying shared libraries to ram disk
strip: /tmp/mnt.1514/ram/lib/ld-linux.so.2: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libc.so.6: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libdl.so.2: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libhistory.so.4.1: No such file or directory
strip: /tmp/mnt.1514/ram/lib/liblvm.so: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libreadline.so.4.1: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libtermcap.so.2: No such file or directory lvmcreate_initrd -- creating linuxrc
lvmcreate_initrd -- ERROR creating linuxrc

[root@farpt1 /tmp]# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda6             1.3G  1.2G   20M  98% /
/dev/hda1              45M  4.3M   39M  10% /boot
/dev/lvg01/home       1.0G  129M  895M  13% /home
/dev/lvg01/usr        2.0G  1.3G  753M  63% /usr
/dev/lvg01/src        700M  181M  519M  26% /usr/src
/dev/lvg01/local      1.0G  517M  507M  51% /usr/local
/dev/lvg01/var        300M  121M  179M  40% /var
/dev/ram1             7.0M  876k  6.1M  12% /tmp/mnt.1514/ram
#3 lore raw

Re: [linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me

Les,

I remember a similar problem from a different initrd: with such a small file system, there aren't enough inodes created to hold a large number of small files. For example, "/dev/*" files don't require much actual file system space, but a disproportionate number of file pointers are required. I believe this is controlled by reducing the bytes/inode setting in mke2fs (but I forget).

My lvmcreate_initrd says: "mke2fs -m0 -i 1024 $DEVRAM $INITRDSIZE"

The way to test this is to execute each of the commands in lvmcreate_initrd manually: when the error occurs, return to the point where "mke2fs" is run using a different value for "-i". You should at least see the error messages start on different files for each iteration.

Note that a lot of the commands used in lvmcreate_initrd pipe their error output to /dev/null. Don't do this during testing.

Also, are you sure your ramdisk size is 8MB? The default is 4MB: it needs to be set on the lilo command line or when configuring the current kernel. I think this is a mistake... since the initrd is not necessarily being built on the same system where it's going to be used, ramdisks should be avoided (since it may require rebooting if you're not already setup for 8MB ramdisks), using a loopback filesystem would be easier (if it's not currently part of the kernel, then the module can be loaded -- no reason to reboot).

Hope that helps,

Chris

Quoted 68 lines · Les Hazelton

I have been working on a problem with 0.8final - lvmcreate_initrd for the past week or so - off and on. The problem is that the step where the files are copied to the ram disk fails for lack of space even though the ram disk has about 7 meg free.

If I duplicate the commands from the command line I can create an 8 meg ram disk and fill the full 8 meg.

My system is running Mandrake 7.2 and the kernel is the source distributed by Mandrake kernel-2.2.17-21mdk patched with lvm-0.8final-2.2.16TL.patch.

As far as I can tell, everything else is working correctly. I can extend my reiserfs filesystems which are on LVs while they are on-line and in use with no identified problems. I just can't build a new initrd for a new kernel compile.

I have attached a copy of the lvmcreate_initrd output and that of a df command also.

I would appreciate any ideas on how to resolve this.

------------------------------------------------------------------------

[root@farpt1 /tmp]# lvmcreate_initrd

Logical Volume Manager 0.8 by Heinz Mauelshagen 11/11/1999

lvmcreate_initrd -- this script creates a LVM initial ram disk in /boot/initrd.gz

lvmcreate_initrd -- making ram filesystem
lvmcreate_initrd -- mounting ram filesystem
lvmcreate_initrd -- creating etc/conf.modules
lvmcreate_initrd -- creating new modules.dep
lvmcreate_initrd -- copying files to ram disk
find: /lib/modules/2.2.17-21mdk-01/block/lvm.o: No such file or directory lvmcreate_initrd -- figuring out shared libraries lvmcreate_initrd -- copying shared libraries to ram disk
strip: /tmp/mnt.1514/ram/lib/ld-linux.so.2: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libc.so.6: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libdl.so.2: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libhistory.so.4.1: No such file or directory
strip: /tmp/mnt.1514/ram/lib/liblvm.so: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libreadline.so.4.1: No such file or directory
strip: /tmp/mnt.1514/ram/lib/libtermcap.so.2: No such file or directory lvmcreate_initrd -- creating linuxrc
lvmcreate_initrd -- ERROR creating linuxrc

[root@farpt1 /tmp]# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda6             1.3G  1.2G   20M  98% /
/dev/hda1              45M  4.3M   39M  10% /boot
/dev/lvg01/home       1.0G  129M  895M  13% /home
/dev/lvg01/usr        2.0G  1.3G  753M  63% /usr
/dev/lvg01/src        700M  181M  519M  26% /usr/src
/dev/lvg01/local      1.0G  517M  507M  51% /usr/local
/dev/lvg01/var        300M  121M  179M  40% /var
/dev/ram1             7.0M  876k  6.1M  12% /tmp/mnt.1514/ram

wrk.txt

Content-Type:

text/plain
Content-Encoding:

7bit

#4 lore raw

Re: [linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me

Chris, you write:

Quoted 6 lines

For example, "/dev/*" files don't require much
actual file system space, but a disproportionate number of file pointers are required. I believe this is controlled by reducing the bytes/inode setting in mke2fs (but I forget).

My lvmcreate_initrd says: "mke2fs -m0 -i 1024 $DEVRAM $INITRDSIZE"

I submitted a new lvmcreateinitrd script in another message which fixes several things, but now I realize it may not help Les. The "-i 1024" option will create the maximum number of inodes that mke2fs will allow using this option. He can change the code (which is commented out in my patch) to use "mke2fs -N" which will allow him to create enough inodes (more than "mke2fs -i" will allow). You need at least mke2fs 1.14 to do this. Maybe I will automate this as well.

Quoted 4 lines

The way to test this is to execute each of the commands in lvmcreate_initrd manually: when the error occurs, return to the point where "mke2fs" is run using a different value for "-i". You should at least see the error messages start on different files for each iteration.

This is automated in my new script. Les must have > 8192 devices.

Quoted 2 lines

Note that a lot of the commands used in lvmcreate_initrd pipe their error output to /dev/null. Don't do this during testing.

This is also fixed - commands run quietly, but you can see any errors.

Quoted 8 lines

Also, are you sure your ramdisk size is 8MB? The default is 4MB: it needs to be set on the lilo command line or when configuring the current kernel. I think this is a mistake... since the initrd is not necessarily being built on the same system where it's going to be used, ramdisks should be avoided (since it may require rebooting if you're not already setup for 8MB ramdisks), using a loopback filesystem would be easier (if it's not currently part of the kernel, then the module can be loaded -- no reason to reboot).

The old script uses a loopback filesystem, not a ramdisk, to build the image.

Cheers, Andreas

Signature · 3 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
#5 lore raw

Re: [linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me

In reply to Les Hazelton

Les, you write:

Quoted 4 lines

I have been working on a problem with 0.8final - lvmcreate_initrd for the past week or so - off and on. The problem is that the step where the files are copied to the ram disk fails for lack of space even though the ram disk has about 7 meg free.

Is it possible you are running out of inodes on the ram disk? You can check with "df -i". Looking at the lvmcreateinitrd script, this should not happen because you have 1 inode per 1kB filesystem, so you should have 8000 inodes (probably too many, or not if you have a large /dev).

I had a look at the lvmcreateinitrd script and fixed a few things. I've attached the whole file here, because the patch is larger than the file. The code is generally the same, but it seems I changed something on more than half of the lines. Joe, can you please consider adding to CVS?

- call the ramdisk initrd-lvm-$VERSION.gz to allow multiple ramdisk images
- use INITRDSIZE when creating the initrd image (not fixed 8192 blocks) (this was already in the Changelog, but appears not to have been fixed?)
- don't include /sbin/modprobe in INITRDFILES twice (cpio complains)
- don't include /dev in INITRDFILES (handle /dev separately)
- check for kernel/drivers/md/lvm-mod.o, block/lvm-mod.o and block/lvm.o, rather than just using kernel version (no error if LVM is in kernel)
- mount ramdisk at /tmp/mnt.$$ instead of /tmp/mnt.$$/ram (no real benefit)
- add cleanup function called on all errors or interrupt or exit
- use sh HERE documents when creating files /etc/fstab /linuxrc
- check libraries for all INITRDFILES files, not just /sbin/vgscan and /bin/sh
- check /etc/modules.conf before /etc/conf.modules (the preferred order)
- don't redirect messages to /dev/null all the time (hard to troubleshoot), instead have the commands be quiet unless there is an error
- remove bashisms in case we are using real /bin/sh instead of bash
- don't cd to ramdisk, because it is busy if we have an error (can't unmount)

Cheers, Andreas
===========================================================================
#!/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=8192
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 \)`
mke2fs -q -F -m0 -i $BYTES_PER_INODE $DEVRAM $INITRDSIZE
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

Signature · 3 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
#6 lore raw

Re: [linux-lvm] [lvm 0.8 final] lvmcreate_initrd fails for me

Quoted 1 line · Andreas Dilger

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.

Quoted 1 line

- call the ramdisk initrd-lvm-$VERSION.gz to allow multiple ramdisk

I really like the new name - saves me from changing it by hand ;-)

Quoted 1 line

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.

Signature · 3 lines
Good Journey, longevity and prosperity to all

Les Hazelton

#!/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

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Hi everyone, Hi Chris

ok, I think I have a little solution for my problem with the LVM over SoftwareRaid. It's seems to
work with the new beta version (sorry I don't try the patch for the 0.9).
So we have only one little problem, if we boot our system the raid1 (mirror)-system don't start correctly.
(on off the mirror disk isn't running). In that case the lvm don't start too !?

But I think that's more a problem of the SoftwareRaid , possible it's a hardware failure of the disk or the disk have a very high startup time. But I don't understand why lvm don't startup, normally this is a transparenc fault , or ?

byebye Juergen

Quoted 96 lines

Chris Worley wrote:

Jürgen,

You are correct. That is a very good question (and valid for this newsgroup). I don't have an answer. I've seen the documentation that says you can make raid 10 & 50 (etc...) by mixing MD's under PV's, as well as making VG's out of LVM's (but why?). I've also seen errors if I haven't set my PV's partition to 8e... and there's no way to fdisk an MD (to set the partition type). I would worry about the performance of two layers of software overhead below the file system.

I had barely crawled out of bed when I saw your post and thought "I can help a newbie". This is not a trivial question, I was wrong ;)

Chris

Quoted 77 lines · Jürgen Frank
Quoted 8 lines · Chris Worley

Jürgen,

"md" and "lvm" are two different ways of making a software raid.

lvm only does raid0. The main purpose of LVM is to allow you to manage disks underneath the file system... adding and removing disks dynamically.

Jep, that's the point why I want to use this two systems. So I want to create a RAID 1 / 5 system and on the top I put the LVM. With this method I have a good system with snapshot and enlargment feature !!! And if I read all the docu (the howto, the pdf from sistina) lvm works fine with the md - drives. But, that is the point which I can't follow in the moment. Because I can't make partitions on a md drive and LVM need this partitions ...

Quoted 4 lines

There should be HOWTO's for md in your /usr/doc area. The LVM newsgroup is not a good place to ask MD related questions. There are a few "howto's" for LVM:

Quoted 8 lines

http://www.sistina.com/lvm/Pages/howto.html

I like:

http://www.ds9a.nl/lvm-howto/HOWTO//cvs/lvm-howto/lvm-howto.html

Chris

I read all this docu, but I can't find any help for a system LVM over MD-Drives (Software RAID) !!!

Juergen

Quoted 33 lines
Quoted 30 lines · Jürgen Frank

Hi !!

I want to create the following system :

I use the new kernel (2.4) and I want to use the software raid and the lvm,
but my problem is... how ?

I can't find a step by step documentation and all what I try don't work.

So what did I done :

* create a mirror system with software raid (last version), after this step I have a good raid system with the drive /dev/md0

* normally now I need to create a partition on the drive , but I read in the raid docu that the md-drives don't support partitions !!!

But, without a partiton of the type 0x8e I can't run vgscan and pvcreate...

So, can anyone help me ?!

Juergen

(sorry for the bad english)
_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Yes, the init script is running before the LVM should start. The Raid-System startup, too, but not correctly. (one of the mirror disk failed)

Quoted 129 lines

Joe Thornber wrote:

Hi,

Are the software raid init scripts being called before the LVM ones ?

- Joe

Quoted 120 lines · Jürgen Frank

Hi everyone, Hi Chris

ok, I think I have a little solution for my problem with the LVM over SoftwareRaid. It's seems to
work with the new beta version (sorry I don't try the patch for the 0.9).
So we have only one little problem, if we boot our system the raid1 (mirror)-system don't start correctly.
(on off the mirror disk isn't running). In that case the lvm don't start too !?

But I think that's more a problem of the SoftwareRaid , possible it's a hardware failure of the disk or the disk have a very high startup time. But I don't understand why lvm don't startup, normally this is a transparenc fault , or ?

byebye Juergen

Quoted 12 lines

Chris Worley wrote:

Jürgen,

You are correct. That is a very good question (and valid for this newsgroup). I don't have an answer. I've seen the documentation that says you can make raid 10 & 50 (etc...) by mixing MD's under PV's, as well as making VG's out of LVM's (but why?). I've also seen errors if I haven't set my PV's partition to 8e... and there's no way to fdisk an MD (to set the partition type). I would worry about the performance of two layers of software overhead below the file system.

Quoted 84 lines

I had barely crawled out of bed when I saw your post and thought "I can help a newbie". This is not a trivial question, I was wrong ;)

Chris

Quoted 77 lines · Jürgen Frank
Quoted 8 lines · Chris Worley

Jürgen,

"md" and "lvm" are two different ways of making a software raid.

lvm only does raid0. The main purpose of LVM is to allow you to manage disks underneath the file system... adding and removing disks dynamically.

Jep, that's the point why I want to use this two systems. So I want to create a RAID 1 / 5 system and on the top I put the LVM. With this method I have a good system with snapshot and enlargment feature !!! And if I read all the docu (the howto, the pdf from sistina) lvm works fine with the md - drives. But, that is the point which I can't follow in the moment. Because I can't make partitions on a md drive and LVM need this partitions ...

Quoted 4 lines

There should be HOWTO's for md in your /usr/doc area. The LVM newsgroup is not a good place to ask MD related questions. There are a few "howto's" for LVM:

Quoted 8 lines

http://www.sistina.com/lvm/Pages/howto.html

I like:

http://www.ds9a.nl/lvm-howto/HOWTO//cvs/lvm-howto/lvm-howto.html

Chris

I read all this docu, but I can't find any help for a system LVM over MD-Drives (Software RAID) !!!

Juergen

Quoted 33 lines
Quoted 30 lines · Jürgen Frank

Hi !!

I want to create the following system :

I use the new kernel (2.4) and I want to use the software raid and the lvm,
but my problem is... how ?

I can't find a step by step documentation and all what I try don't work.

So what did I done :

* create a mirror system with software raid (last version), after this step I have a good raid system with the drive /dev/md0

* normally now I need to create a partition on the drive , but I read in the raid docu that the md-drives don't support partitions !!!

But, without a partiton of the type 0x8e I can't run vgscan and pvcreate...

So, can anyone help me ?!

Juergen

(sorry for the bad english)
_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm

_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm