Tech Tip: Retrieve Disk Info from the Command Line
You can use the following command line tools to retrieve the make and model of your hard drives without the need to open up your system.
First, you need the device names of your disks, for this you can use df or cat /proc/partitions. Example device names are names such as /dev/hda or /dev/sdb. For the following examples, where applicable, I will use /dev/sda as my disk device.
Use the lshw command:
$ lshw -class disk ... -disk:0 product: ST3250310NS vendor: Seagate version: SN04 serial: 9SF0000TH size: 232GiB (250GB)
Use the smartctl command:
$ smartctl -i /dev/sda ... Device Model: ST3250310NS Serial Number: 9SF0000TH Firmware Version: SN04 ...
Note: You may need to install the 'smartmontools' package, your output will vary depending on smartctl version and disk make/model.
Use the hdparm command:
$ hdparm -i /dev/sda /dev/sda: Model=ST3250310NS, FwRev=SN04, SerialNo=9SF0000TH ...
Use the hwinfo command:
$ hwinfo --disk ... Model: "ST3250310NS" Device: "ST3250310NS" Revision: "SN04" Serial ID: "9SF0000TH" ...
Note: You may need to install the 'hwinfo' package.
Note, you will need to be root to get the full output from these commands.
And one additional way that you can determine the model and serial number of your disk:
$ ls /dev/disk/by-id ata-ST3250310NS_9SF0000TH ata-ST3250310NS_9SF0000TH-part1 ata-ST3250310NS_9SF0000TH-part2 ata-ST3250310NS_9SF0000TH-part3
Here the model number is ST3250310NS, and the serial number is 9SF0000TH.
Getting Started with DevOps - Including New Data on IT Performance from Puppet Labs 2015 State of DevOps Report
August 27, 2015
12:00 PM CDT
DevOps represents a profound change from the way most IT departments have traditionally worked: from siloed teams and high-anxiety releases to everyone collaborating on uneventful and more frequent releases of higher-quality code. It doesn't matter how large or small an organization is, or even whether it's historically slow moving or risk averse — there are ways to adopt DevOps sanely, and get measurable results in just weeks.
Free to Linux Journal readers.Register Now!
- August 2015 Issue of Linux Journal: Programming
- Hacking a Safe with Bash
- Django Models and Migrations
- Secure Server Deployments in Hostile Territory, Part II
- The Controversy Behind Canonical's Intellectual Property Policy
- Huge Package Overhaul for Debian and Ubuntu
- Shashlik - a Tasty New Android Simulator
- Embed Linux in Monitoring and Control Systems
- KDE Reveals Plasma Mobile
- General Relativity in Python