Is there an easier to way to find out which /dev/ my flash drive is connected to...
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
Distribution: slackware 12.0, Vector Linux STD 6.0 and 5.8, ZenWalk 4.6.1, OpenBSD 3.9
Posts: 389
Rep:
Quote:
Originally Posted by trist007
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. .
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
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.
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.
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
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.
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.
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..
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?
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.
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.
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?
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.