LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-16-2010, 04:27 PM   #1
Lobinho
Member
 
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/hotplug.sh I can mount the /dev/udisk device on anywhere I wanna):

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

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

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, 09:34 PM   #2
conman124
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"

--Connor
 
Old 06-18-2010, 08:09 AM   #3
Lobinho
Member
 
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/hotplug.sh" 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/hotplug.sh" script I'll use this information.
 
Old 06-18-2010, 10:15 AM   #4
Bratmon
Member
 
Registered: Jul 2009
Location: 75.126.162.205:80
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, 12:07 PM   #5
Lobinho
Member
 
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Original Poster
Rep: Reputation: 18
Hi Bratmon,

I think you reefer to something like this: http://blog.bigsmoke.us/2009/02/06/c...ware-with-udev

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 12:08 PM.
 
  


Reply



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 02:26 AM
why only "mount /dev/sda /mnt/usb" works and not "mount /dev/sda1..." ? gromot Linux - General 7 05-19-2009 10:18 AM
dvdrw on VAIO: "mount: /dev/hdb is not a valid block device" Haystack Linux - Hardware 13 01-06-2007 02:33 PM
"the device node /dev/hda6 for the root filsystem is missing" after a sudden halt braungiobi Linux - General 0 05-09-2006 02:53 PM
"unable to find device node for /dev/x in /dev!" during install zombiedeth *BSD 0 02-02-2004 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:49 PM.

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