LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 03-19-2009, 04:36 AM   #1
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 972

Rep: Reputation: 56
Is there an easier to way to find out which /dev/ my flash drive is connected to...


Everytime I plug in my usb flash drive, I have to to some work. For example, I put in the usb flash drive then I

cd /mnt
mount /dev/sdb1 /mnt/sdb1
mount /dev/sdc1 /mnt/sdc1
mount /dev/sdd1 /mnt/sdd1
mount /dev/sde1 /mnt/sde1

(all the sdx1 were already created)

I have to do each one until I get no error, then I know that the flash drive is tied to that /dev. Is there an easier way to find out which /dev/sdx1 the flash drive gets tied to after I plug the flash drive into the computer? Also, how would I find out which /dev/ my sd card gets connected to?
 
Old 03-19-2009, 04:41 AM   #2
ic_torres
Member
 
Registered: Nov 2005
Location: ABAP
Distribution: slackware 12.0, Vector Linux STD 6.0 and 5.8, ZenWalk 4.6.1, OpenBSD 3.9
Posts: 389

Rep: Reputation: 34
Quote:
Originally Posted by trist007 View Post
Everytime I plug in my usb flash drive, I have to to some work. For example, I put in the usb flash drive then I

cd /mnt
mount /dev/sdb1 /mnt/sdb1
mount /dev/sdc1 /mnt/sdc1
mount /dev/sdd1 /mnt/sdd1
mount /dev/sde1 /mnt/sde1

(all the sdx1 were already created)

I have to do each one until I get no error, then I know that the flash drive is tied to that /dev. Is there an easier way to find out which /dev/sdx1 the flash drive gets tied to after I plug the flash drive into the computer? Also, how would I find out which /dev/ my sd card gets connected to?


what distro are you using? before plugging your usb drive, tail your /var/log/messages,


then plug the drive, the log should show wat drive is plugged into the computer. . from then you will know what device is your drive..

if your distro supports the hotplug(is this the one?) it should detect your drive automatically.. (in my case Vector linux detects it ) but slackware does not. so i just did what i have suggested you. most probably its, /dev/sda1 OR /dev/sdb1 .. not sure. .
 
Old 03-19-2009, 05:07 AM   #3
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35
Or after you have plugged it in, use the command 'dmesg' to find out which device it is.

Robin
 
Old 03-19-2009, 07:32 AM   #4
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
I use tail as well.. and actually you can use tail BEFORE you plug in the drive so you can watch it being detected and identified.. this can be very usefull when troubleshooting.

Code:
it-lenny:~# tail -f /var/log/messages
Mar 19 07:47:02 it-etch syslogd 1.5.0#5: restart.
Mar 19 08:17:01 it-etch -- MARK --
-- plug in USB drive --
Mar 19 08:30:26 it-etch kernel: usb 6-8: new high speed USB device using ehci_hcd and address 23
Mar 19 08:30:26 it-etch kernel: usb 6-8: configuration #1 chosen from 1 choice
Mar 19 08:30:26 it-etch kernel: scsi22 : SCSI emulation for USB Mass Storage devices
Mar 19 08:30:31 it-etch kernel:   Vendor: USB2.0    Model: FlashDisk         Rev: 1100
Mar 19 08:30:31 it-etch kernel:   Type:   Direct-Access                      ANSI SCSI revision: 00
Mar 19 08:30:31 it-etch kernel: SCSI device sdc: 999424 512-byte hdwr sectors (512 MB)
Mar 19 08:30:31 it-etch kernel: sdc: Write Protect is off
Mar 19 08:30:31 it-etch kernel: SCSI device sdc: 999424 512-byte hdwr sectors (512 MB)
Mar 19 08:30:31 it-etch kernel: sdc: Write Protect is off
Mar 19 08:30:31 it-etch kernel:  sdc: sdc1
Mar 19 08:30:31 it-etch kernel: sd 22:0:0:0: Attached scsi removable disk sdc
Mar 19 08:30:31 it-etch kernel: sd 22:0:0:0: Attached scsi generic sg2 type 0
so you can see it identified my USB flash drive as /dev/sdc1
 
Old 03-22-2009, 03:19 PM   #5
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 972

Original Poster
Rep: Reputation: 56
What about for SD cards?

I inserted my SD card and checked /var/log/messages

and got

mmc0: new SDHC card at address 8fe4
mmcblk0: mmc0:8fe4 SD04G 3872256KiB
mmcblk0: p1

and I've tried making directories mmc0, mmcblk0, and p1 and for each one I've tried mounting, ie.

mount /dev/mmc0 /mnt/mmc0
mount /dev/mmcblk0 /mnt/mmcblk0
mount /dev/p1 /mnt/p1

and for all I've gotten: No such file or directory.

I double checked the config file for my kernel

[CODE]
[trist007@darkstar:/boot] $ cat config-final-2.6.27.7-smp | grep MMC
# CONFIG_PCI_GOMMCONFIG is not set
CONFIG_PCI_MMCONFIG=y
CONFIG_MMC=m
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_UNSAFE_RESUME is not set
# MMC/SD Card Drivers
CONFIG_MMC_BLOCK=m
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_MMC_TEST is not set
# MMC/SD Host Controller Drivers
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_RICOH_MMC=m
CONFIG_MMC_WBSD=m
CONFIG_MMC_TIFM_SD=m
[\CODE]

So I have the modules required, but which ones do I load specifically?

I tried loading
modprobe sdhci and still I wasn't able to mount. I checked the /var/log/messages and dmesg and it said that there was no valid FAT or NTFS or ext3 filesystem on the sd card.

Last edited by trist007; 03-23-2009 at 01:47 AM.
 
Old 03-23-2009, 07:28 AM   #6
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35
Code:
mmc0: new SDHC card at address 8fe4
mmcblk0: mmc0:8fe4 SD04G 3872256KiB
mmcblk0: p1
None of this is a device you can mount. It might be that the device had not settled yet and no device node had yet been created when you entered dmesg. But more probably your system simply isn't set up correctly. Most modern distributions would mount the device automatically so you wouldn't have to worry about it at all.

My Ubuntu system spits out all the following lines when I attach a USB stick:

Code:
[19167.684000] usb 2-5: new high speed USB device using ehci_hcd and address 2
[19167.820000] usb 2-5: configuration #1 chosen from 1 choice
[19168.032000] usbcore: registered new interface driver libusual
[19168.108000] Initializing USB Mass Storage driver...
[19168.112000] scsi0 : SCSI emulation for USB Mass Storage devices
[19168.112000] usb-storage: device found at 2
[19168.112000] usb-storage: waiting for device to settle before scanning
[19168.112000] usbcore: registered new interface driver usb-storage
[19168.112000] USB Mass Storage support registered.
[19173.112000] usb-storage: device scan complete
[19173.112000] scsi 0:0:0:0: Direct-Access     OTi      Flash Disk       2.00 PQ: 0 ANSI: 2
[19174.212000] ready
[19174.212000] sd 0:0:0:0: [sda] 128000 512-byte hardware sectors (66 MB) <- so sda is the device
[19174.212000] sd 0:0:0:0: [sda] Write Protect is off
[19174.212000] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[19174.212000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[19174.216000] sd 0:0:0:0: [sda] 128000 512-byte hardware sectors (66 MB)
[19174.216000] sd 0:0:0:0: [sda] Write Protect is off
[19174.216000] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[19174.216000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[19174.216000]  sda: sda1 <- partition sda1
[19174.220000] sd 0:0:0:0: [sda] Attached SCSI removable disk
[19174.232000] sd 0:0:0:0: Attached scsi generic sg0 type 0
Of course Ubuntu automounts this. Maybe your kernel doesn't have the appropriate drivers enabled (ohci_hcd, ehci_hcd, uhci_hcd depending, afaik, on device). Messages like yours do not appear on any system of mine.

Robin

Last edited by bitpicker; 03-23-2009 at 07:30 AM.
 
Old 03-23-2009, 07:39 AM   #7
XenaneX
Member
 
Registered: Jan 2009
Location: Tokyo, Japan
Distribution: PClinuxOS
Posts: 112
Blog Entries: 3

Rep: Reputation: 18
I use PCLinuxOS 2007 and 2009.1
Open Konqueror file browser (KDE based).
Plug in USB stick.
Click on entry for USB stick that appears.
Read Konqueror location bar which says:
media:/sdb1

Voila
 
Old 03-23-2009, 08:28 AM   #8
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,058

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
I would suggest you ditch PClinuxOS and get a "real" distro-that might start an argument!
Ubuntu/Debian/Slackware will have no problem with what you want.
 
Old 03-23-2009, 09:10 AM   #9
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35
Well, linus72, you just shot yourself in the foot... XenaneX doesn't have a problem with USB-sticks, the original poster trist007 has, and lo and behold, he's apparently using Slackware.

Robin
 
Old 03-23-2009, 09:28 AM   #10
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by trist007 View Post
What about for SD cards?

I inserted my SD card and checked /var/log/messages

and got

mmc0: new SDHC card at address 8fe4
mmcblk0: mmc0:8fe4 SD04G 3872256KiB
mmcblk0: p1

and I've tried making directories mmc0, mmcblk0, and p1 and for each one I've tried mounting, ie.

mount /dev/mmc0 /mnt/mmc0
mount /dev/mmcblk0 /mnt/mmcblk0
mount /dev/p1 /mnt/p1

and for all I've gotten: No such file or directory.

I double checked the config file for my kernel

[CODE]
[trist007@darkstar:/boot] $ cat config-final-2.6.27.7-smp | grep MMC
# CONFIG_PCI_GOMMCONFIG is not set
CONFIG_PCI_MMCONFIG=y
CONFIG_MMC=m
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_UNSAFE_RESUME is not set
# MMC/SD Card Drivers
CONFIG_MMC_BLOCK=m
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_MMC_TEST is not set
# MMC/SD Host Controller Drivers
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_RICOH_MMC=m
CONFIG_MMC_WBSD=m
CONFIG_MMC_TIFM_SD=m
[\CODE]

So I have the modules required, but which ones do I load specifically?

I tried loading
modprobe sdhci and still I wasn't able to mount. I checked the /var/log/messages and dmesg and it said that there was no valid FAT or NTFS or ext3 filesystem on the sd card.
You do have a SDHC Card reader right ? SDHC cards do not work in standard SD card readers..

Sorry, have to ask the basic questions first, so we don't waste time with more complex measures, if the underlying hardware isn't correct..
 
Old 03-23-2009, 11:38 AM   #11
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 972

Original Poster
Rep: Reputation: 56
The specification page for my laptop says that it has a Secure Digital, Memory Stick, Memory Stick Pro, MultiMedia Card, and xD Picture Card, that all fit in the same slot. I guess I don't have a SDHC slot. Is there support for the ones I have in linux?
 
Old 03-23-2009, 12:49 PM   #12
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
There is support in Linux for SDHC cards, but you have to have the appropriate card reading hardware for it.
SD cards will work in a SDHC card reader, but not the other way around.

Once review for this unit states that it works well with Linux.
http://reviews.pricegrabber.com/flas...cs/m/34878983/
 
Old 03-24-2009, 05:05 AM   #13
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35
I suppose that if the kernel sees a SDHC card, then it means that the reader can use it correctly; otherwise the reader should not even be able to react to the presence of the card, and the kernel shouldn't recognize it. The problem lies in the next step: I think the kernel sees the card correctly but there is no event which gets triggered by that, no device node made, and then there is nothing to mount.

Robin
 
Old 03-24-2009, 10:14 AM   #14
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 972

Original Poster
Rep: Reputation: 56
In my post above, when I tail /var/log/messages after inserting the SD Card, the output says that the SDHC Card is located at address 8fe4. Isn't there a way to manually create a /dev that points to that memory address? I guess it would be more complicated than that wouldn't it?
 
Old 03-24-2009, 01:19 PM   #15
trist007
Member
 
Registered: May 2008
Distribution: Slackware
Posts: 972

Original Poster
Rep: Reputation: 56
In one of my above posts, I cat the config of my kernel. I seem to have all the modules for mmc. How do I find out the names or aliases of all those modules so that I can modprobe them?
 
  


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
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
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 07:16 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 1 12-24-2005 04:25 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 02:15 AM


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

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