In Linux, knowing how to display disk information is essential for managing storage. This includes understanding disk usage, identifying partitions, and checking disk details like model and firmware. Accessing this information helps you maintain system performance and avoid storage issues.
The steps to retrieve disk information are simple. You can use built-in commands to list disks, view partitions, and get detailed information about each disk. These commands work across most Linux distributions, including Ubuntu.
This guide provides a straightforward approach to displaying disk information in Linux. Whether you need basic disk usage data or specific details like the disk's serial number, these steps will help you get the information you need quickly.
Steps to list and view disk information:
- Open the terminal in your Linux system.
- List all available disks using the following command.
lsblk | grep disk sda 8:0 0 20G 0 disk sdb 8:16 0 20G 0 disk
- Display the partitions on each disk.
lsblk | grep part ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 513M 0 part /boot/efi └─sda3 8:3 0 19.5G 0 part /
- Find the disk model and brand.
sudo hdparm -I /dev/sda | grep Model Model Number: WDC WD60EFAX-68SHWN0
- Retrieve the serial number of the disk.
sudo hdparm -I /dev/sda | grep Serial Serial Number: WD-WX31D43KSK3A
- Check the firmware version.
sudo hdparm -I /dev/sda | grep Firmware Firmware Revision: 82.00A82
- Identify the disk's RPM speed.
sudo hdparm -I /dev/sda | grep Rotation Nominal Media Rotation Rate: 5400
- Benchmark the disk speed.
sudo hdparm -tT /dev/sda /dev/sda: Timing cached reads: 27522 MB in 2.00 seconds = 13783.98 MB/sec Timing buffered disk reads: 1976 MB in 3.00 seconds = 658.03 MB/sec
The above benchmarks test the read speed of the disk. Cached reads show the speed from memory, while buffered reads show the speed from the disk.
- View the SMART health status.
sudo smartctl -H /dev/sda SMART Health Status: OK
The SMART status provides a quick health check of the disk.
- Show the UUID of disks and partitions.
blkid /dev/sda3: UUID="a7d71686-0a65-4402-b6e6-b58430ef8351" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0ea90c96-1b56-4c51-b07a-02e09285f291"
- Display usage and free space for all mounted disks.
df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 20G 7.4G 11G 41% /
- Check the hard drive temperature.
sudo hddtemp /dev/sda /dev/sda: TOSHIBA MQ01ACF050: 39°C
- Review disk-related kernel messages.
sudo dmesg | grep sda [ 3.439451] sd 32:0:0:0: [sda] 41943040 512-byte logical blocks: (21.5 GB/20.0 GiB) [ 3.439497] sd 32:0:0:0: [sda] Write Protect is off [ 3.458951] sda: sda1 sda2 sda3
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.