some question about mdev

loody miloody at gmail.com
Sun May 23 08:23:39 UTC 2010


hi Denys:

2010/5/23 Denys Vlasenko <vda.linux at googlemail.com>:
> On Saturday 22 May 2010 14:33, loody wrote:
>> Dear all:
>> I use mdev to handle hotplug event under linux.
>> it runs fine when I plug/unplug usb flash.
>> But it has some problem when I plug/unplug usb HD.
>> Below are my partions I get when I plug my USB HD.
>>
>> # cat /proc/partitions
>> major minor  #blocks  name
>>
>>    8        0    1972224 sda
>>    8        1    1970546 sda1
>>    8       16  156290904 sdb
>>    8       17          1 sdb1
>>    8       21  156280288 sdb5
>> #
>>
>> and below is my mdev.conf
>> sd[a-zA-Z][0-9]+ 0:0 0660 * /usr/bin/autoscript.sh $MDEV $LABEL
>>
>> As you can see, mdev will pass sdb1 to /usr/bin/autoscript.sh for mounting.
>> But the partion cannot be mount.( from the information in
>> /proc/partitions, it seems some place for data saving.)
>
> Please show autoscript.sh, exact mount command parameters and its error message.
> Also, what "cat /proc/filesystems" says? What is your busybox version?
>
> --
> vda
>

I guess my problem comes from 2 parts:
1. Mdev will pass every partition to autorun.sh for mounting.
But in my case, there is a super block partition. ( like the extension
partition)
2. when mdev pass different format partitions to autorun.sh,
autorun.sh should use different mount parameters for mounting. But it
doesn't.

my questions are:
1. how could I stop mdev to pass the superblock partition to autorun.sh
2. is there additional paramter that mdev can pass to shell such that
they can know the format is different?
BR,
miloody

below is my autorun.sh

#! /bin/sh
if [ "$1" == "" ]; then
echo "parameter is none" > /tmp/error.txt
exit 1
fi
mounted=`mount | grep $1 | cut -d ' ' -f 3`

if [ ! -z $mounted ]; then
        echo "R$mounted" >> /tmp/usbmnt.log
        echo "R$mounted" > /tmp/fifo.1
        if ! umount "$mounted"; then
        exit 1
        fi
        if ! rmdir "$mounted"; then
        exit 1
        fi
else
        if [ -z "$2" ];then
                dir=$1
        else
                dir=$2
        fi
        if ! mkdir -p "/media/$dir"; then
        exit 1
        fi

        if ! mount -o codepage=437,iocharset=iso8859-1,utf8 "/dev/$1"
"/media/$dir"; then
        if ! rmdir "/media/$dir"; then
        exit 1
        fi
        exit 1
        fi
        echo "A/media/$dir" >> /tmp/usbmnt.log
        echo "A/media/$dir" > /tmp/fifo.1
fi
exit 0

below is my /proc/filesystems
# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   sockfs
nodev   pipefs
nodev   anon_inodefs
nodev   tmpfs
nodev   inotifyfs
nodev   devpts
        ext3
        ext2
nodev   ramfs
        vfat
nodev   nfs
nodev   cifs
        ntfs
nodev   rpc_pipefs

and below is my dmesg scsi pops out
sd 11:0:0:0: [sda] 312581808 512-byte hardware sectors: (160 GB/149 GiB)
sd 11:0:0:0: [sda] Write Protect is off
sd 11:0:0:0: [sda] Mode Sense: 03 00 00 00
sd 11:0:0:0: [sda] Assuming drive cache: write through
sd 11:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1 < sda5 >
sd 11:0:0:0: [sda] Attached SCSI disk


More information about the busybox mailing list