Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-16-2010, 05:27 PM   #1
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Rep: Reputation: 18
mount custom device node (ex: "/dev/mydevice")

Dear all,

I'm trying to mount a custom device node for each usb port of my pc. For example:
Every pen drive connected to my usb 1-1.2 will be called /dev/usb2 and mounted on /mnt/usb2, on usb 1-1.3 port the device node will be called /dev/usb3 and mounted on /mnt/usb3.

I'm using an embedded linux, the device handler is mdev. Editing mdev.rules I'm able to manage new devices and write special rules for them (on /bin/ I can mount the /dev/udisk device on anywhere I wanna):

# This will be called after scsi emulation, so the 
# new device (sda1, sdb1 ...) will be managed by /bin/
mmcblk0p1	0:0	0600	=sdcard */bin/
sda1		0:0	0600	=udisk * /bin/

# This is called when pen drive is connected
1-1.*		0:0	0600	@ /home/lobinho/ $MDEV
The problem is that SCSI emulation define to me the name of the device in order of insertion (following an alphabetical sequence):

Is there anyway to change scsi emulation configurations or code?
I want to call my pen drive on my way (/dev/usb1 instead of /dev/sd*)!

Someone knows any tip or tutorial that will help me?

Thanks in advance!
Old 06-17-2010, 10:34 PM   #2
LQ Newbie
Registered: Jun 2010
Posts: 6

Rep: Reputation: 0
Well, if your USB drive is at the same /dev/sd* every time (Say, every time you plug it in, it is at /dev/sda) then you can create a symlink. "ln /dev/sda /dev/usb1 -s"

Old 06-18-2010, 09:09 AM   #3
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Original Poster
Rep: Reputation: 18
Hi conman124,

I can have more than one usb drive connected at the same time, so I need to know where they came from (usb port 1-1.1, usb port 1-1.2, ... ).

The "/bin/" script (scsi emulation) runs after the creation of the usb device on /sys/bus/usb, so I'll try to do something to keep reading this dir and show up what's new. Then on the "/bin/" script I'll use this information.
Old 06-18-2010, 11:15 AM   #4
Registered: Jul 2009
Distribution: Arch / Mint 17
Posts: 297
Blog Entries: 3

Rep: Reputation: 50
This isn't exactly what you're asking, but if it was the same drives every time, couldn't you use /dev/disk/by-uuid ?
Old 06-19-2010, 01:07 PM   #5
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Original Poster
Rep: Reputation: 18
Hi Bratmon,

I think you reefer to something like this:

On my project I'll have a PC with 2 usb ports available. These ports must have exclusive functions:
USB 1 - (1-1.1) - Only for system backup. This port will accept any generic pen drive and will save a data log on it. This function will be automatic.
USB 2 - (1-1.2) - Save/Load configuration. This port will accept any generic pen drive and save or load some configuration files.

There's no user interface program or line cmd. It's like a server with some services running and nobody will access the system. The only communication with the external world is these two usb ports.

The problem starts when some user plugged a pen drive and inside the system I don't know which usb port he is using (usb1 or usb2), so I don't know if I have to save the log file or not.

Thanks anyway!

Last edited by Lobinho; 06-19-2010 at 01:08 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount userspace directory as "/dev" block device for USB Gadget API? Robert_A Programming 5 02-17-2011 03:26 AM
why only "mount /dev/sda /mnt/usb" works and not "mount /dev/sda1..." ? gromot Linux - General 7 05-19-2009 11:18 AM
dvdrw on VAIO: "mount: /dev/hdb is not a valid block device" Haystack Linux - Hardware 13 01-06-2007 03:33 PM
"the device node /dev/hda6 for the root filsystem is missing" after a sudden halt braungiobi Linux - General 0 05-09-2006 03:53 PM
"unable to find device node for /dev/x in /dev!" during install zombiedeth *BSD 0 02-02-2004 03:38 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration