Archive for the ‘CLI on the FLY’ Category.

How To find the model of a USB harddrive in a USB enclosure in Linux

NOTE: This is not working totally with USB3 interfaced drives. Likely a update to the tools will fix this.

The following command:

smartctl -i /dev/sdb

Where hdparm /sdparm (and lsusb -v) show you info about the USB device this gives you the info about the device IN the USB enclosure.
Here is output:
=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda XT
Device Model:     ST33000651AS
Serial Number:    9XK0AKRX
LU WWN Device Id: 5 000c50 02d957ba3
Firmware Version: CC43
User Capacity:    3,000,592,982,016 bytes [3.00 TB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Fri Apr 12 08:17:27 2013 EDT
SMART support is: Available – device has SMART capability.
SMART support is: Enabled

Linux CLI on the FLY (interface stats)

I am going to start a new section of Linux CLI foo  that you may or may not know about. Many of these will be faster ways of doing things or getting information in a slightly different fashion. Many are old favorites of mine that I just wanted to share in case they help someone else.

Now without further ado the first command is :

ip -s l

short for ip stats list this gives a fast overview of your interfaces and  the types of packets that have been going through them. Output looks like this :

[root@pbnj lisa11]# ip -s l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes  packets  errors  dropped overrun mcast
1084866683 400954   0       0       0       0
TX: bytes  packets  errors  dropped carrier collsns
1084866683 400954   0       0       0       0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:30:48:61:c7:64 brd ff:ff:ff:ff:ff:ff
RX: bytes  packets  errors  dropped overrun mcast
552827144  1541759  0       0       0       0
TX: bytes  packets  errors  dropped carrier collsns
1428902993 1445402  0       0       0       0
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 00:30:48:61:c7:65 brd ff:ff:ff:ff:ff:ff
RX: bytes  packets  errors  dropped overrun mcast
0          0        0       0       0       0
TX: bytes  packets  errors  dropped carrier collsns
0          0        0       0       0       0

More information on interface stats can be found via:
ethtool -S $DEVICE
ifconfig $device (or just ifconfig for all devices)
ifconfig -s $DEVICE

among others….