[linux-lvm] lvm2 device mapper

Yanick Quirion yanick.quirion at neokimia.com
Wed Dec 10 08:39:02 UTC 2003


Hi,

Did you compile device mapper as a module or into the kernel?

Here I have compile them into the kernel directly. You must add this line into your /etc/modules.conf:

post-install dm-mod /etc/rc.d/init.d/devmap_mknod.sh

And the script /etc/rc.d/init.d/devmap_mknod.sh is next:

#! /bin/sh

# Startup script to create the device-mapper control device
# on non-devfs systems.
# Non-zero exit status indicates failure.

# These must correspond to the definitions in device-mapper.h and dm.h
DM_DIR="mapper"
DM_NAME="device-mapper"

set -e

DIR="/dev/$DM_DIR"
CONTROL="$DIR/control"

# Check for devfs, procfs
if test -e /dev/.devfsd ; then
        echo "devfs detected: devmap_mknod.sh script not required."
        exit
fi

if test ! -e /proc/devices ; then
        echo "procfs not found: please create $CONTROL manually."
        exit 1
fi

# Get major, minor, and mknod
MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)
MINOR=$(sed -n "s/^ *\([0-9]\+\) \+$DM_NAME\$/\1/p" /proc/misc)

if test -z "$MAJOR" -o -z "$MINOR" ; then
        echo "$DM_NAME kernel module not loaded: can't create $CONTROL."
        exit 1
fi

mkdir -p --mode=755 $DIR
test -e $CONTROL && rm -f $CONTROL

echo "Creating $CONTROL character device with major:$MAJOR minor:$MINOR."
mknod --mode=600 $CONTROL c $MAJOR $MINOR

With that everything works fine. If you use them as a module, I'm not sure, but I think that you will have to add it into your rc.local, or create a startup script for devmap_mknod.sh, but I'm not really sure about that.

Hope this will help.

Regards,

Yanick Quirion


-----Original Message-----
From: Salil Taneja, Noida [mailto:salilt at noida.hcltech.com] 
Sent: 10 December, 2003 02:13
To: 'linux-lvm at sistina.com'
Cc: Salil Taneja, Noida
Subject: [linux-lvm] lvm2 device mapper

hi,
 
I am using LVM2 , version -2.00.07 with device mapper library -1.00.07 on 2.6.0 test-9 kernel
 
i am facing these problems while doing so : -
 
1.) i get a warning message
    " /dev/mapper/control : open failed : No such file or directory .
       Is device mapper mapped to kernel ? "
 
To overcome this problem I started using LVM2 commands   with --driverloaded n option .
 
now the commands execute but i face another problem :-
2.) when using lvcreate or vgcreate, the command executes but no node entry is created  in the /dev/ directory
For eg :
 
I used the following command :
    lvcreate < options > -n lvm1 vg1 --driverloaded n
 
to verify this i used lvdisplay that gives the path of lvm1 as /dev/vg1/lvm1 ; but when i check in /dev/ directory there is no entry corresponding to vg1 or lvm1 .
 
Why isnt there any node corresoponding to vg1 or lvm1 in /dev/ ?  any clues...?????
 
 
Please suggest some nice solutions .
 
Thanks and Regards, 
Salil Taneja 
HCLT NetCentric Division, 
A11, Sector 16, 
Noida, India. 
  office: +91-120-2510701 Ext 3155 
  cell: +91-9810250247 

 




More information about the linux-lvm mailing list