CyberKeeda In Social Media

Linux Command to find Hard disk serial number and details.

Most of the times, when a linux system contains more then 1 hard drives and during the process of re installation to keep the user data safe and simply format the system without effecting the user data placed in another physical drive, we face challenges while discriminating hardisks by sda, sdb, sdc

The best approach is to identify the hard disk serial number and the apply actions accordingly.

So in my case i have two hard disks as sda and sdb one hard disk has system files and configurations and one has user data 

I have identified this using pvs command

[root@cyberkeeda ~]# pvs

     PV         VG       Fmt  Attr PSize   PFree
  /dev/sda2  rootvg   lvm2 a--u 465.25g    0

  /dev/sdb1  homevg lvm2 a--u 465.75g    0

I can easily identify from here, which hdd has root file, system files installed within it.

here sda  -- system files
       sdb  -- user data

Find the hard disk details from the below mentioned commands.


[root@cyberkeeda ~]# hdparm -I /dev/sd? | grep 'Serial\ Number'

Output will look like

       Serial Number:      WD-WCC2SFS30435
       Serial Number:      WD-WCC2HEFS25680

One can also use lshw or smartctl to fetch more details of hard drives


[root@cyberkeeda ~]# lshw -class disk


[root@cyberkeeda ~]#  smartctl -i /dev/sda

If you are missing those tools, just install following packages

# apt-get install smartmontools
# yum install  smartmontools

# apt-get install lshw
# yum install lshw

No comments:

Post a Comment

Designed By Jackuna