LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is there an easier to way to find out which /dev/ my flash drive is connected to... (http://www.linuxquestions.org/questions/linux-newbie-8/is-there-an-easier-to-way-to-find-out-which-dev-my-flash-drive-is-connected-to-712756/)

trist007 03-19-2009 05:36 AM

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?

ic_torres 03-19-2009 05:41 AM

Quote:

Originally Posted by trist007 (Post 3480454)
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. .

bitpicker 03-19-2009 06:07 AM

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

Robin

farslayer 03-19-2009 08:32 AM

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

trist007 03-22-2009 04:19 PM

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.

bitpicker 03-23-2009 08:28 AM

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

XenaneX 03-23-2009 08:39 AM

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

linus72 03-23-2009 09:28 AM

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.

bitpicker 03-23-2009 10:10 AM

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

farslayer 03-23-2009 10:28 AM

Quote:

Originally Posted by trist007 (Post 3484241)
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..

trist007 03-23-2009 12:38 PM

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?

farslayer 03-23-2009 01:49 PM

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/

bitpicker 03-24-2009 06:05 AM

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

trist007 03-24-2009 11:14 AM

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?

trist007 03-24-2009 02:19 PM

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?


All times are GMT -5. The time now is 01:15 PM.