LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-21-2009, 05:33 AM   #1
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Rep: Reputation: 30
Inquiry:How to recognize the assigned device for attached usb memory?


Dear All
I have attached usb memory to my Linux server and I want to add it to my /etc/fstab . Can you please let me know how can I recognize it from my"/dev/?" list ?
Thank you in advance
 
Old 12-21-2009, 05:56 AM   #2
RichyAD
LQ Newbie
 
Registered: Sep 2008
Location: Porto, Portugal
Distribution: Fedora 9-16, Linux Mint
Posts: 28

Rep: Reputation: 0
hadimotamedi, can you tell us which distro your linux server is running?

Normally usb drives are detected and mounted automatically. On Fedora usb drives are mounted under /media. For example: /media/usb/, /media/disk/, or /media/[drive name]

[EDIT]
usb devices can be located at: /dev/sda[1-9] to /dev/sdz[1-9], or even /dev/usb depending on the distro and hardware configuration.

Last edited by RichyAD; 12-21-2009 at 05:59 AM.
 
Old 12-21-2009, 06:09 AM   #3
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by RichyAD View Post
hadimotamedi, can you tell us which distro your linux server is running?

Normally usb drives are detected and mounted automatically. On Fedora usb drives are mounted under /media. For example: /media/usb/, /media/disk/, or /media/[drive name]

[EDIT]
usb devices can be located at: /dev/sda[1-9] to /dev/sdz[1-9], or even /dev/usb depending on the distro and hardware configuration.
Thank you for your reply . I am using CentOS 5.2 . Can you please help me finding the assigned device ?
 
Old 12-21-2009, 06:16 AM   #4
Davno
Member
 
Registered: Mar 2004
Location: Montreal, Canada
Distribution: Mandriva 2010.2
Posts: 148

Rep: Reputation: 24
Hi,
I am not in front of a linux computer right now, so i can not be 100% certain about that, but i would look at the UUID number of your device and put that in my fstab.
Specially pratical if you need to identify one usb drive from another one for something like a backup script.
Might work !
 
Old 12-21-2009, 06:21 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
You can check the device name from dmesg command.
 
Old 12-21-2009, 06:38 AM   #6
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by linuxlover.chaitanya View Post
You can check the device name from dmesg command.

How can read my device name "/dev/?" from dmesg output ?
 
Old 12-21-2009, 06:40 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Connect your device and then run dmesg command and look into the output of the command what it says.
Else do this and post the output here so that someone here can help you out.
 
Old 12-21-2009, 06:43 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Run dmesg just after plugging in the device and look for lines near the end of the output containing "usb" and/or "/dev/sd"

Optionally, lsscsi is a useful command for this: but I don't if it is installed on your system.

Cheers,

Evo2.
 
Old 12-21-2009, 06:47 AM   #9
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Another way is to use it by uuid instead of name. uuid will not change even if the device is removed and re-plugged.
You can connect the device and then check for uuid in /dev/disk/by-uuid directory.
 
Old 12-21-2009, 06:57 AM   #10
RichyAD
LQ Newbie
 
Registered: Sep 2008
Location: Porto, Portugal
Distribution: Fedora 9-16, Linux Mint
Posts: 28

Rep: Reputation: 0
Additionally you can run "ll /dev/disk/by-label/". That'll give you a list of all attached labelled drives and their /dev/sd[].
 
Old 12-21-2009, 07:01 AM   #11
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by evo2 View Post
Run dmesg just after plugging in the device and look for lines near the end of the output containing "usb" and/or "/dev/sd"

Optionally, lsscsi is a useful command for this: but I don't if it is installed on your system.

Cheers,

Evo2.
Can you please help me find it from the followings ?
[root@mss-0 ~]# dmesg |grep -i usb
usbcore: registered new driver usbfs
usbcore: registered new driver hub
usbcore: registered new driver hiddev
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
ehci_hcd 0000:00:0b.0: new USB bus registered, assigned bus number 1
ehci_hcd 0000:00:0b.0: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
ohci_hcd 0000:00:06.0: new USB bus registered, assigned bus number 2
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
USB Universal Host Controller Interface driver v3.0
usbcore: registered new driver wcusb
Wildcard USB FXS Interface driver registered
INFO-xpp_usb: revision trunk-r6058
usbcore: registered new driver xpp_usb
 
Old 12-21-2009, 07:16 AM   #12
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Its not showing what the device is recognized as. Post the output without grep.
It should show something like this:

Code:
[28727.437375] sd 4:0:0:0: Attached scsi generic sg1 type 0
[28727.438886] sd 4:0:0:0: [sdb] 15679488 512-byte logical blocks: (8.02 GB/7.47 GiB)
[28727.439489] sd 4:0:0:0: [sdb] Write Protect is off
[28727.439493] sd 4:0:0:0: [sdb] Mode Sense: 23 00 00 00
[28727.439496] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[28727.444246] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[28727.444254]  sdb: sdb1
[28727.604384] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[28727.604390] sd 4:0:0:0: [sdb] Attached SCSI removable disk
 
Old 12-21-2009, 07:18 AM   #13
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Also as I posted in earlier post, connect the device and check the entries in /dev/disk folder. You should have sub folder there for by-uuid, by-id and so on.
You could check with by-uuid or by-id for it. It would be much safer if you want to mount the usb device at boot. This would mount the device no matter if the name is changed.
 
Old 12-21-2009, 09:06 PM   #14
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Quote:
Originally Posted by RichyAD View Post
Additionally you can run "ll /dev/disk/by-label/". That'll give you a list of all attached labelled drives and their /dev/sd[].
"ll"? perhaps you have an alias of some sort?
Code:
type ll
Evo2.
 
Old 12-21-2009, 09:08 PM   #15
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
I wonder if you have the needed kernel moudles. Can you please post the output of

Code:
 lsmod | grep -E 'usb|scsi'
Evo2.

Last edited by evo2; 12-21-2009 at 09:09 PM. Reason: typo
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inquiry:How to write *.iso image files onto USB memory stick hadimotamedi Linux - Newbie 4 09-06-2009 04:49 AM
getting the correct USB device for attached mobile phone drkstr Linux - Software 14 02-19-2008 04:14 AM
USB HD being assigned different device names neddis Linux - Hardware 1 11-11-2007 11:22 AM
dm does not load if usb device attached grey man Mandriva 1 03-17-2006 10:48 AM
Fuji M603, SCSI device not assigned via USB anotherlimey Linux - Laptop and Netbook 5 03-14-2004 02:13 AM

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

All times are GMT -5. The time now is 05:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration