LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 07-03-2013, 08:22 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 565

Rep: Reputation: Disabled
understand how Linux deals with devices


I am trying to better understand how Linux deals with devices. To start, I am trying to identify the device that I am using by looking at /var/log/messages and plugging in a USB. Is this the best way to do so? What if I had two hard drives; how would I tell one from the other?

I often see some gibberish related to usb 1-1.4: Product: USB Optical Mouse. I am thinking this is totally unrelated, right?

I then disconnect the USB memory stick and see usb 3-2: USB disconnect, device number 2. What does usb 3-2 and device number 2 tell me?

I then plug it in and see usb 3-2: new high speed USB device number 3 using xhci_hcd. Same usb 3-2, but now I see device number 3. Why the different device number?

I then see some messages related to scsi, and finally see sdf1. Okay, is this how I know my device is /dev/sdf1?

What next topics are import to this subject. I am thinking they are mount, fstab, and fdisk. Any others? Any recommended tutorials?

Sorry for the scattered questions. This is still rather mystic to me. Thank you

Code:
[root@desktop mnt]# tail -f /var/log/messages
Jul  2 22:56:47 desktop kernel: generic-usb 0003:0461:4D0F.0320: input,hidraw2: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:00:1a.0-1.4/input0
Jul  2 22:57:35 desktop kernel: usb 1-1.4: USB disconnect, device number 57
Jul  2 22:57:37 desktop kernel: usb 1-1.4: new low speed USB device number 58 using ehci_hcd
Jul  2 22:57:37 desktop kernel: usb 1-1.4: New USB device found, idVendor=0461, idProduct=4d0f
Jul  2 22:57:37 desktop kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jul  2 22:57:37 desktop kernel: usb 1-1.4: Product: USB Optical Mouse
Jul  2 22:57:37 desktop kernel: usb 1-1.4: Manufacturer: PixArt
Jul  2 22:57:37 desktop kernel: usb 1-1.4: configuration #1 chosen from 1 choice
Jul  2 22:57:37 desktop kernel: input: PixArt USB Optical Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input812
Jul  2 22:57:37 desktop kernel: generic-usb 0003:0461:4D0F.0321: input,hidraw2: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:00:1a.0-1.4/input0
Jul  2 22:58:25 desktop kernel: usb 1-1.4: USB disconnect, device number 58
Jul  2 22:58:26 desktop kernel: usb 1-1.4: new low speed USB device number 59 using ehci_hcd
Jul  2 22:58:26 desktop kernel: usb 1-1.4: New USB device found, idVendor=0461, idProduct=4d0f
Jul  2 22:58:26 desktop kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jul  2 22:58:26 desktop kernel: usb 1-1.4: Product: USB Optical Mouse
Jul  2 22:58:26 desktop kernel: usb 1-1.4: Manufacturer: PixArt
Jul  2 22:58:26 desktop kernel: usb 1-1.4: configuration #1 chosen from 1 choice
Jul  2 22:58:26 desktop kernel: input: PixArt USB Optical Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input813
Jul  2 22:58:26 desktop kernel: generic-usb 0003:0461:4D0F.0322: input,hidraw2: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:00:1a.0-1.4/input0
Jul  2 22:58:45 desktop kernel: usb 3-2: USB disconnect, device number 2
Jul  2 22:58:49 desktop kernel: usb 3-2: new high speed USB device number 3 using xhci_hcd
Jul  2 22:58:49 desktop kernel: usb 3-2: New USB device found, idVendor=0930, idProduct=6545
Jul  2 22:58:49 desktop kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul  2 22:58:49 desktop kernel: usb 3-2: Product: DataTraveler 2.0
Jul  2 22:58:49 desktop kernel: usb 3-2: Manufacturer: Kingston
Jul  2 22:58:49 desktop kernel: usb 3-2: SerialNumber: 001D0F1E3695ED3027AD0058
Jul  2 22:58:49 desktop kernel: usb 3-2: configuration #1 chosen from 1 choice
Jul  2 22:58:49 desktop kernel: usb 3-2: ep 0x81 - rounding interval to 32768 microframes, ep desc says 0 microframes
Jul  2 22:58:49 desktop kernel: usb 3-2: ep 0x2 - rounding interval to 32768 microframes, ep desc says 0 microframes
Jul  2 22:58:49 desktop kernel: scsi7 : SCSI emulation for USB Mass Storage devices
Jul  2 22:58:50 desktop kernel: scsi 7:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 4
Jul  2 22:58:50 desktop kernel: sd 7:0:0:0: Attached scsi generic sg6 type 0
Jul  2 22:58:51 desktop kernel: sd 7:0:0:0: [sdf] 60978816 512-byte logical blocks: (31.2 GB/29.0 GiB)
Jul  2 22:58:51 desktop kernel: sd 7:0:0:0: [sdf] Write Protect is off
Jul  2 22:58:51 desktop kernel: sd 7:0:0:0: [sdf] Assuming drive cache: write through
Jul  2 22:58:51 desktop kernel: sd 7:0:0:0: [sdf] Assuming drive cache: write through
Jul  2 22:58:51 desktop kernel: sdf: sdf1
Jul  2 22:58:51 desktop kernel: sd 7:0:0:0: [sdf] Assuming drive cache: write through
Jul  2 22:58:51 desktop kernel: sd 7:0:0:0: [sdf] Attached SCSI removable disk
Jul  2 22:59:02 desktop cpuspeed: Disabling performance cpu frequency scaling governor
Jul  2 22:59:02 desktop cpuspeed: Enabling ondemand cpu frequency scaling governor
Jul  2 22:59:03 desktop cpuspeed: Disabling ondemand cpu frequency scaling governor
Jul  2 22:59:03 desktop cpuspeed: Enabling performance cpu frequency scaling governor
Jul  2 22:59:06 desktop kernel: usb 3-2: USB disconnect, device number 3
Jul  2 22:59:10 desktop kernel: usb 3-2: new high speed USB device number 4 using xhci_hcd
Jul  2 22:59:10 desktop kernel: usb 3-2: New USB device found, idVendor=0930, idProduct=6545
Jul  2 22:59:10 desktop kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul  2 22:59:10 desktop kernel: usb 3-2: Product: DataTraveler 2.0
Jul  2 22:59:10 desktop kernel: usb 3-2: Manufacturer: Kingston
Jul  2 22:59:10 desktop kernel: usb 3-2: SerialNumber: 001D0F1E3695ED3027AD0058
Jul  2 22:59:10 desktop kernel: usb 3-2: configuration #1 chosen from 1 choice
Jul  2 22:59:10 desktop kernel: usb 3-2: ep 0x81 - rounding interval to 32768 microframes, ep desc says 0 microframes
Jul  2 22:59:10 desktop kernel: usb 3-2: ep 0x2 - rounding interval to 32768 microframes, ep desc says 0 microframes
Jul  2 22:59:10 desktop kernel: scsi8 : SCSI emulation for USB Mass Storage devices
Jul  2 22:59:11 desktop kernel: scsi 8:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 4
Jul  2 22:59:11 desktop kernel: sd 8:0:0:0: Attached scsi generic sg6 type 0
Jul  2 22:59:12 desktop kernel: sd 8:0:0:0: [sdf] 60978816 512-byte logical blocks: (31.2 GB/29.0 GiB)
Jul  2 22:59:12 desktop kernel: sd 8:0:0:0: [sdf] Write Protect is off
Jul  2 22:59:12 desktop kernel: sd 8:0:0:0: [sdf] Assuming drive cache: write through
Jul  2 22:59:12 desktop kernel: sd 8:0:0:0: [sdf] Assuming drive cache: write through
Jul  2 22:59:12 desktop kernel: sdf: sdf1
Jul  2 22:59:12 desktop kernel: sd 8:0:0:0: [sdf] Assuming drive cache: write through
Jul  2 22:59:12 desktop kernel: sd 8:0:0:0: [sdf] Attached SCSI removable disk
Jul  2 22:59:14 desktop kernel: usb 1-1.4: USB disconnect, device number 59
Jul  2 22:59:16 desktop kernel: usb 1-1.4: new low speed USB device number 60 using ehci_hcd
Jul  2 22:59:16 desktop kernel: usb 1-1.4: New USB device found, idVendor=0461, idProduct=4d0f
Jul  2 22:59:16 desktop kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jul  2 22:59:16 desktop kernel: usb 1-1.4: Product: USB Optical Mouse
Jul  2 22:59:16 desktop kernel: usb 1-1.4: Manufacturer: PixArt
Jul  2 22:59:16 desktop kernel: usb 1-1.4: configuration #1 chosen from 1 choice
Jul  2 22:59:16 desktop kernel: input: PixArt USB Optical Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input814
Jul  2 22:59:16 desktop kernel: generic-usb 0003:0461:4D0F.0323: input,hidraw2: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:00:1a.0-1.4/input0
^C
[root@desktop mnt]#
 
Old 07-03-2013, 08:32 AM   #2
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 565

Original Poster
Rep: Reputation: Disabled
Part 2

Trying to understand what mount is telling me.

Where is sda2? It must be /dev/mapper/vg_desktop-lv_root, but why isn't it called sda2?

What is proc, sysfs, devpts, tmpfs, none, and sunrpc all about?

Why don't I see my swap memory mounted?

Thanks again.

Code:
[root@desktop /]# mount
/dev/mapper/vg_desktop-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdf1 on /mnt/device type vfat (rw)
[root@desktop /]#

Last edited by NotionCommotion; 07-03-2013 at 08:37 AM.
 
Old 07-03-2013, 08:58 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,604
Blog Entries: 25

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Member Response

Hi,

To help you understand things better;
Quote:
From Slackware®-Links Devices;

Udev: Introduction to Device Management In Modern Linux System <- 'Udev supplies a dynamic device directory containing only the nodes for devices which are connected to the system. It creates or removes the device node files in the /dev directory as they are plugged in or taken out.'
Writing udev rules <- 'This document assumes that you have udev installed and running OK with default configurations. This is usually handled by your Linux distribution.'
Persistent block device naming <- 'This article describes how to use persistent names for your block devices. This has been made possible by the introduction of udev and has some advantages over bus-based naming.'
Right To Your Own Devices <- By Kapil Hari Paranjape Great device mapper article
For you to read for understanding;
Quote:
RAMdisk/tmpfs <- 'tmpfs is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but one which uses virtual memory instead of a persistent storage device.' + LQ post example
initrd <- 'The initial ramdisk, or initrd is a temporary file system commonly used in the boot process of the Linux kernel. It is typically used for making preparations before the real root file system can be mounted'
inode pointer structure - 'The inode pointer structure is a structure adopted by the inode of a file in the Unix File System (UFS) or other related file systems to list the addresses of a file's data blocks' + Ext3 for large file systems + A Basic UNIX Tutorial + A Fast File System for UNIX + Computer file systems
sticky bit <- 'The sticky bit is an access-right flag that can be assigned to files and directories on Unix systems.'
Quote:
Understanding UNIX/Linux file system:
Part I <- Understanding Linux filesystems
Part II <- Understanding Linux superblock
Part III <- An example of Surviving a Linux Filesystem Failures
Part IV <- Understanding filesystem Inodes
Part V <- Understanding filesystem directories
Part VI <- Understanding UNIX/Linux symbolic (soft) and hard links
Part VII <- Why isn’t it possible to create hard links across file system boundaries?
Quote:
Just a few links to aid you to gaining more understanding;



1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Utimate Linux Newbie Guide
10 Linux Home Networking
11 Virtualization- Top 10

The above links and others can be found at 'Slackware-Links'. More than just Slackware® links!
A good tutorial: UNIX Tutorial for Beginners <- Guide to Unix & Linux OS
Plus do not forget LQ Tutorials
HTH!
 
Old 07-03-2013, 09:48 AM   #4
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 565

Original Poster
Rep: Reputation: Disabled
Thanks Gary,

Lots of good information. A little intimidating at times

Hoping to get some clarification.

First, is the process I explained on figuring out which device name corresponds to a given slot on my computer accurate?

Second, the main hard drive is /dev/mapper/vg_desktop-lv_root, correct? Why is it not called /dev/sda2?

Thanks again
 
Old 07-03-2013, 10:35 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Check out /dev and /proc. /dev as now handled by udev is covered by the link onebuck gave you. Normal harddrives go by /dev/sd*. (* is a shell glob and means all one or nothing [guess you know that]). /dev/mapper is for pseudo devices. Like LVM and other fancy stuff. /proc is what the kernel sees. cat /proc/diskstats.
 
Old 07-03-2013, 11:45 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,604
Blog Entries: 25

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Member Response

Hi,
Quote:
Originally Posted by NotionCommotion View Post
Thanks Gary,

Lots of good information. A little intimidating at times

Hoping to get some clarification.

First, is the process I explained on figuring out which device name corresponds to a given slot on my computer accurate?

Second, the main hard drive is /dev/mapper/vg_desktop-lv_root, correct? Why is it not called /dev/sda2?

Thanks again
One step at a time!

Look at the 'udev' information links. As to kernel related terms then you might consider http://kernelnewbies.org/ for specifics.

Most of the tutorial links are provided for newbies/intermediate users. Rute Tutorial & Exposition should be one to consider to acquaint yourself with Linux.

BTW, You are Welcome!
 
  


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
LXer: Patent Deals With Microsoft Mean Death To Linux? LXer Syndicated Linux News 0 07-20-2007 04:16 PM
LXer: What's What in Dell's Linux Deals LXer Syndicated Linux News 2 05-12-2007 08:45 AM
LXer: HP Sees Huge Linux Desktop Deals LXer Syndicated Linux News 0 03-07-2007 08:46 AM
Microsoft open to more Linux deals? Interdictor Linux - News 4 11-13-2006 02:49 PM
how linux deals with bios settings jig Linux - Hardware 8 11-13-2004 06:59 AM


All times are GMT -5. The time now is 07:44 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