LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
  Search this Thread
Old 12-26-2012, 03:47 PM   #1
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Rep: Reputation: 24
command line; how identify which /dev/??? a device is on


As root, when I plug in a USB device, like my ebook reader or mp3 player, how do I determine which /dev/??? it is on in order to mount it?

I checked the output of dmesg immediately after inserting the device (below), but am none the wiser.
Code:
[ 5499.914031] usb 1-3: new high-speed USB device number 6 using ehci_hcd
[ 5502.799271] hub 1-0:1.0: unable to enumerate USB device on port 3
[ 5503.109025] usb 1-3: new high-speed USB device number 7 using ehci_hcd
[ 5505.994271] hub 1-0:1.0: unable to enumerate USB device on port 3
[ 5506.303034] usb 1-3: new high-speed USB device number 8 using ehci_hcd
[ 5509.188272] hub 1-0:1.0: unable to enumerate USB device on port 3
[ 5537.126026] usb 1-6: reset high-speed USB device number 4 using ehci_hcd
[ 6816.927032] usb 1-3: new high-speed USB device number 9 using ehci_hcd
[ 6819.812291] hub 1-0:1.0: unable to enumerate USB device on port 3
[ 6820.123027] usb 1-3: new high-speed USB device number 10 using ehci_hcd
 
Old 12-26-2012, 03:54 PM   #2
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 134Reputation: 134
I use

Code:
fdisk -l
 
1 members found this post helpful.
Old 12-26-2012, 04:17 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
df -hT
after it mounts.
 
Old 12-26-2012, 04:35 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,678

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
It depends. What is the make/model of your ebook reader? Post the output of the command lsusb.

Some devices use MTP (Media Transfer Protocol) and therefore are not recognised as mass storage devices. Applications to read/write to MTP require the libmtp package and there are many depending on if it is a MP3 player or digital camera etc as well as a fuse filesystem i.e. mtpfs that allows for mounting.
 
1 members found this post helpful.
Old 12-26-2012, 05:02 PM   #5
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Original Poster
Rep: Reputation: 24
habamaru
Code:
fdisk -l
shows only my hard drives, internal and external, that are already mounted

Habitual
Code:
df -hT
can't use, because the objective is to find out how to mount the device by hand

michaelk The ereader is a StoryHD by iriver. Following is the output of lsusb, as it does not show there I assume it is an MTP device; except that my San Disk mp3 player does show and it seems to be am mtp device. libmtp is not installed, but there has to be another method because the file manager Dolphin will recognize the device and mount it
Code:
/home/g # lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0bc2:2300 Seagate RSS LLC Expansion Portable
Bus 001 Device 004: ID 0bc2:50a5 Seagate RSS LLC FreeAgent GoFlex Desk USB 3.0
Bus 001 Device 005: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless Adapter
Bus 003 Device 002: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 001 Device 013: ID 0781:74d0 SanDisk Corp. Sansa Clip+ (mtp)
Bus 001 Device 016: ID 04da:2372 Panasonic (Matsushita) Lumix Camera
Which suggested to me to have Dolphin mount it and then see what lsusb showed, and now it includes the line
Code:
Bus 001 Device 020: ID 1006:4034 iRiver, Ltd.
So can I maybe access it through its ID #?

Last edited by porphyry5; 12-26-2012 at 05:30 PM.
 
Old 12-26-2012, 07:14 PM   #6
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
Do your plug-in devices have filesystems with volume labels? I recommend doing this - give them labels, like EBOOK or MP3. Then you can just use commands like this:

Code:
$ udisksctl mount -b /dev/disk/by-label/EBOOK
Mounted /dev/sdc1 at /run/media/yourname/EBOOK
(You do not need to be root for this.)

(Yes, this is a variation on the command I posted to your other question, where we knew the device name but not the volume label or mount point. The above is for when we know the volume label, but not the device name. -b is short for --block-device)
 
2 members found this post helpful.
Old 12-26-2012, 07:59 PM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i run sudo tail -f /var/log/messages (hit enter a few times to show some blank lines) then plug in my devices. the output of messages should contain info regarding those devices.
 
1 members found this post helpful.
Old 12-26-2012, 08:02 PM   #8
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by ljb643 View Post
Do your plug-in devices have filesystems with volume labels? I recommend doing this - give them labels, like EBOOK or MP3. Then you can just use commands like this:

Code:
$ udisksctl mount -b /dev/disk/by-label/EBOOK
Mounted /dev/sdc1 at /run/media/yourname/EBOOK
(You do not need to be root for this.)

(Yes, this is a variation on the command I posted to your other question, where we knew the device name but not the volume label or mount point. The above is for when we know the volume label, but not the device name. -b is short for --block-device)
udisksctl was the first thing I tried to see if it would show me the /dev concerned, but it also requires that one have the device identified. I've not used labels, I use the UUID instead to mount by, which I get via this command
Code:
/home/g/ToInstall/1.1-release # blkid   
/dev/sda1: UUID="7c7321e2-73dc-4317-b32c-96dd46fa89db" TYPE="ext3" 
/dev/sda2: UUID="c5856052-b2e2-4ddf-b922-5aac504ff08b" TYPE="ext4" 
/dev/sda3: UUID="CA98993C98992849" TYPE="ntfs" 
/dev/sda4: UUID="8fea16cb-844d-4dab-860b-dbece5c8b36d" TYPE="swap" 
/dev/sdb1: LABEL="500gb" UUID="20801F50801F2BB2" TYPE="ntfs" 
/dev/sdc1: LABEL="3tb" UUID="7A683F8C683F4663" TYPE="ntfs" 
/dev/sdd: LABEL="SANSA CLIPP" UUID="6818-26B9" TYPE="vfat" 
/dev/sdf: LABEL="Story HD" UUID="0000-001B" TYPE="vfat"
But blkid also only shows things that are already mounted, so I still haven't succeeded in finding the slackware linux command that will identify plug in devices before they are mounted. It has to exist, or these file managers like dolphin wouldn't be able to identify the things they mount.
 
Old 12-26-2012, 08:13 PM   #9
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
UUIDs are OK for things like internal hard disks, where you want to be sure you are talking about the right device, and you put them in fstab or whatever and never touch them. But volume labels are much handier for portable plug-in things.

Quote:
I still haven't succeeded in finding the slackware linux command that will identify plug in devices before they are mounted.
You need some way of referring to the device. If you know the device name, UUID, or volume label, you can get the other parts. But I don't think there is any such command that says: show me info on the most recently plugged in device. That's why I suggest using volume labels.
 
Old 12-26-2012, 08:33 PM   #10
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by schneidz View Post
i run sudo tail -f /var/log/messages (hit enter a few times to show some blank lines) then plug in my devices. the output of messages should contain info regarding those devices.
Thank you, that does show the device even though it is unmounted.
 
Old 12-26-2012, 08:59 PM   #11
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by ljb643 View Post
UUIDs are OK for things like internal hard disks, where you want to be sure you are talking about the right device, and you put them in fstab or whatever and never touch them. But volume labels are much handier for portable plug-in things.


You need some way of referring to the device. If you know the device name, UUID, or volume label, you can get the other parts. But I don't think there is any such command that says: show me info on the most recently plugged in device. That's why I suggest using volume labels.
May have solved the mystery. lsusb shows device information even when the device is unmounted. But it only registers my ereader if the device is turned on when I plug it into the computer. If its turned off when I plug it in, lsusb does not show it, even though the current in the usb plug causes the device to turn on. So both lsusb and schneidz's method using sudo tail -f /var/log/messages do the trick.

As it happens, blkid also shows it even though the device is not mounted, as long as the device is turned on before I plug it into the computer. Seems that was the entirety of the problem. I can mount the thing either by label or by UUID, but udisksctl has a problem.
Code:
/home/g # blkid
/dev/sda1: UUID="7c7321e2-73dc-4317-b32c-96dd46fa89db" TYPE="ext3" 
/dev/sda2: UUID="c5856052-b2e2-4ddf-b922-5aac504ff08b" TYPE="ext4" 
/dev/sda3: UUID="CA98993C98992849" TYPE="ntfs" 
/dev/sda4: UUID="8fea16cb-844d-4dab-860b-dbece5c8b36d" TYPE="swap" 
/dev/sdb1: LABEL="500gb" UUID="20801F50801F2BB2" TYPE="ntfs" 
/dev/sdc1: LABEL="3tb" UUID="7A683F8C683F4663" TYPE="ntfs" 
/dev/sdd: LABEL="Story HD" UUID="0000-001B" TYPE="vfat" 
/home/g # mount  LABEL="Story HD" /mnt/dvd
/home/g # ls /mnt/dvd
book  comic  image  system
/home/g # umount /mnt/dvd
/home/g # mount UUID="0000-001B" /media/dvd1
/home/g # ls /media/dvd1
book  comic  image  system
/home/g # umount /media/dvd1
/home/g # su g
~ $ udisksctl mount -b /dev/disk/by-label/"Story HD"
Error looking up object for device /dev/disk/by-label/Story HD
~ $ su
Password: 
/home/g # udisksctl mount -b /dev/disk/by-label/"Story HD"
Error looking up object for device /dev/disk/by-label/Story HD
And fdisk -l shows it too, if I turn the device on before connecting to the usb port.

Last edited by porphyry5; 12-26-2012 at 11:46 PM.
 
Old 12-26-2012, 11:44 PM   #12
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by kabamaru View Post
I use

Code:
fdisk -l
Thank you, this does give me what I asked for, the /dev/ assignment when the device is connected. I got no response the first time I tried it so I assumed, as the device turned on automatically after I plugged it in to the usb port, that fdisk shows only mounted devices. But if I turn on the device first, then plug it into the usb port, fdisk shows it even though it is not mounted, only connected.
 
  


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
Identify machine and raid version with command line riderryuken Linux - Newbie 3 03-15-2011 09:13 AM
Trying to identify file types(command line arguments) and count how many there are jdwalk Linux - Newbie 5 02-20-2010 03:51 PM
what command will identify which dev file my device was assigned kevmcool Linux - Newbie 3 02-02-2010 06:54 AM
Identify video card from command line? lhouk Solaris / OpenSolaris 3 02-11-2009 03:42 PM
Identify program memory usage from command line MikeyCarter Linux - Software 1 03-04-2008 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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