Ubuntu comes with UDisks2
library, which provides udisks daemon and couple command-line tools to query disk information and otherwise manipulate the drives. In particular, udisksctl status
command is useful if you want to find out the information without root privileges locally.
$ udisksctl status
MODEL REVISION SERIAL DEVICE
--------------------------------------------------------------------------
CHN 25SATA01M 030 P0527A 30CG09180078 sda
Radeon R7 1.01 A22MD061520000172 sdb
Udisk2 provides D-Bus interface, so if you ever want to use that in your own scripts or applications - it's possible. An example of that would be my own disk usage indicator.
Another way is via udevadm
management utility for udev subsystem.
$ udevadm info --query=all --name=/dev/sda1 | grep 'ID_MODEL='
E: ID_MODEL=CHN_25SATA01M_030
Alternative and indirect way is to identify the filesystem stored on the drive by UUID:
$ lsblk -o NAME,UUID
NAME UUID
sda
└─sda1 8e73e463-fef8-4119-b826-00e74eb4192c
sdb
└─sdb1 86df21bf-d95f-435c-9292-273bdbcba056
$ sudo blkid /dev/sda1
[sudo] password for user:
/dev/sda1: UUID="8e73e463-fef8-4119-b826-00e74eb4192c" TYPE="ext4" PARTUUID="73e878a1-01"
Other methods that contain such info:
sudo parted -l
cat /sys/block/sda/device/model