LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 03-08-2013, 09:12 AM   #1
waddles
Member
 
Registered: Sep 2012
Posts: 373

Rep: Reputation: 0
Mapping USB flash drive to its /dev/xxx


I need to associate the flash drive from lsusb with the device name I get by using dmesg (i.e. /dev/sdz). If I wait long enough dmesg no longer has the stuff I need to make the association. Is there an (easier haha) other way?

Last edited by waddles; 03-08-2013 at 09:14 AM.
 
Old 03-08-2013, 02:24 PM   #2
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,014

Rep: Reputation: 145Reputation: 145
ls -l /sys/block/ | grep usb
 
Old 03-08-2013, 02:30 PM   #3
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware-14.0 on a Lenovo T61 6457-4XG
Posts: 3,652

Rep: Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828
cat /proc/partitions

If you don't want to automount some flash drive but want to be able to mount it manually using always the same mount point, plug it in, type as root "blkid" to know its UUID then write a line for it in /etc/fstab replacing /dev/sdz with UUID=<string given by blkid, without the double quotes>.

PS I just saw Guanx' post. As the saying goes: "two slackers, three answers"

Last edited by Didier Spaier; 03-08-2013 at 02:36 PM.
 
1 members found this post helpful.
Old 03-09-2013, 03:42 AM   #4
waddles
Member
 
Registered: Sep 2012
Posts: 373

Original Poster
Rep: Reputation: 0
Thanks guys good responses I need something (unless I am misreading the ls -l /sys/block | grep usb output) which maps 1:1 a bit closer.
lsusb output:
Bus 001 Device 004: ID 154b:005b PNY
Bus 001 Device 005: ID 0781:5530 SanDisk Corp. Cruzer
ls -l /sys/block | grep usb output:
lrwxrwxrwx 1 root root 0 Mar 8 16:38 sdc -> ../devices/pci0000:00/0000:00:10.3/usb1/1-6/1-6.4/1-6.4:1.0/host6/target6:0:0/6:0:0:0/block/sdc
lrwxrwxrwx 1 root root 0 Mar 9 01:33 sdd -> ../devices/pci0000:00/0000:00:10.3/usb1/1-6/1-6.3/1-6.3:1.0/host7/target7:0:0/7:0:0:0/block/sdd
What I need is a way to go from either Bus/Device or mfrr:modl or label to sd?.
Is there a way to do that or did I miss it? Is it the host# -2 = Device 00#?

Last edited by waddles; 03-09-2013 at 03:43 AM.
 
Old 03-09-2013, 05:09 AM   #5
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,014

Rep: Reputation: 145Reputation: 145
lsusb.py
 
Old 03-09-2013, 07:18 AM   #6
enine
Member
 
Registered: Nov 2003
Distribution: Slackware 14.1
Posts: 624

Rep: Reputation: 55
So you just put the /devices entry in fstab?

sdb -> ../devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4:1.0/host4/target4:0:0/4:0:0:0/block/sdb/


I setup a hotplug script several versions ago but it seems they changed everything on me. What I do is take my previous drive and put in a usb enclosure then plug in and rsync my home to it then unplug and put it in the safe. How do I make it automount under /backup and unmount when I unplug it?

like this in fstab:

../devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4:1.0/host4/target4:0:0/4:0:0:0/block/sdb/ /backup auto defaults 1 1
 
Old 03-09-2013, 08:25 AM   #7
XGizzmo
Member
 
Registered: Mar 2007
Distribution: Slackware
Posts: 264

Rep: Reputation: 68
Try lsscsi
 
1 members found this post helpful.
Old 03-09-2013, 05:19 PM   #8
jefro
Guru
 
Registered: Mar 2008
Posts: 10,255

Rep: Reputation: 1256Reputation: 1256Reputation: 1256Reputation: 1256Reputation: 1256Reputation: 1256Reputation: 1256Reputation: 1256Reputation: 1256
I'd agree that you don't want to associate it with the unreliable usb connection that may cause it to go from sdb to sdq or so. Mount by device name or uuid as suggested above.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /dev/disk/by-label DISAPPEARED! Can't mount USB flash drive ShellyCat Linux - Desktop 5 11-16-2010 11:30 PM
using flash drive changes device /dev/sr0 to /dev/sr1 for mapping to /dev/pktcdvd/0? lugoteehalt Linux - Software 3 10-24-2007 10:27 AM
USB flash drive not create driver node in /dev ? saq1980 Linux - Hardware 5 06-22-2007 03:01 AM
Help mounting USB flash drive ... When plugged in I dont have /dev/sda1 device ... ebenh Ubuntu 2 09-17-2006 09:55 PM
usb flash drive: no /dev entry zarg Slackware 3 09-21-2004 03:39 PM


All times are GMT -5. The time now is 04:29 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration