OVH Guide

How do I find the serial number of my hard disk ?

Find here how to retrieve the serial number of a disk in order to proceed with its replacement.

Requirements

To minimize chances of human errors during hard disk replacement, we ask our client to provide the serial number of the disk they whish to replace.

In some cases, for example with a dead hard disk, it is not possible to retrieve the serial number.

In such case, provide the serial number of all other hard disks and ask for the replacement of the disk that is not listed in the serial numbers you provided us.

In most cases, you can find it while testing your hard drives individualy with smartmontools.

To realize this manipulations, it must :

  • Having an SSH access.
  • Having the need to replace a disk.
  • The sas2ircu utility must be installed beforehand. (Available via the broadcom search engine). Only for Windows.

In the case of an NVMe disk, it will be necessary to place the server in Rescue-pro mode, and use the nvme-cli tool installed by default.

For Software RAID

To retrieve your hard drive's serial number with a software RAID configuration, you can simply use smartctl:

 smartctl -a /dev/sdX | grep Serial Serial Number:    XXXXXXX 

The device as detected by the OS (Ex: /dev/sda, /dev/sdb, etc..)

For a NVMe disk

It will be necessary to use the command nvme list :

 root@rescue:~# nvme list Node             SN                   Model                                    Namespace Usage                      Format           FW Rev ---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- -------- /dev/nvme0n1     CVPF636600YC450RGN   INTEL SSDPE2MX450G7                      1         450.10  GB / 450.10  GB    512   B +  0 B   MDV10253 /dev/nvme1n1     CVPF6333002Y450RGN   INTEL SSDPE2MX450G7                      1         450.10  GB / 450.10  GB    512   B +  0 B   MDV10253 

We can then see the serial numbers of our NVMe disks (nvme0 and nvme1).

Sous Windows

The Windows-based guide is similar in general to the Linux-based guide. Indeed, we will use the utility: sas2ircu, and the commands are the same as under Linux.

It will be important to run the command terminal as an administrator to avoid errors.

To retrieve the serial number in the case of a Software RAID, you must use the following command :

 .\smartctl -a /dev/sdX Serial Number:    KKKKKKKKKK 

The device as detected by the OS (Ex: /dev/sda, /dev/sdb, etc..)

smart_sdb_windows

For Hardware RAID

For an in-depth look of these commands and how to test your hard disks, refer to this guide (LSI raid controller).

MegaRaid Controller

Step 1 : Recover RAID sets

You can find the serial number using smartctl command as well. However, prior to execute the smartctl command, you will need to find how many RAID (or Virtual Drive) your server contains.

You can retrieve this information by using the following command:

 MegaCli -LDInfo -Lall -aALL | egrep 'Adapter|Size' | grep -v Strip Adapter 0 — Virtual Drive Information: Size : 36.321 GB Adapter 1 — Virtual Drive Information: Size : 2.727 TB 

In this example, there is two RAIDs configured on the server (Adapter 0 and Adapter 1). These should be mapped to /dev/sda and /dev/sdb.

Step 2 : Recover Disks informations

Next, you will need to gather the physical disk informations using the following command:

 MegaCli -PDList -aAll | egrep 'Slot\ Number|Device\ Id|Inquiry\ Data|Raw|Firmware\ state' | sed 's/Slot/\nSlot/g'   Slot Number: 0 Device Id: 4 Raw Size: 279.460 GB [0x22eec130 Sectors] Firmware state: Online, Spun Up Inquiry Data: BTWL3450062J300PGN  INTEL SSDSC2BB300G4                     D2010355   Slot Number: 1 Device Id: 5 Raw Size: 279.460 GB [0x22eec130 Sectors] Firmware state: Online, Spun Up Inquiry Data: BTWL345003X6300PGN  INTEL SSDSC2BB300G4                     D2010355   Slot Number: 2 Device Id: 7 Raw Size: 2.728 TB [0x15d50a3b0 Sectors] Firmware state: Online, Spun Up Inquiry Data:       PN2234P8K2PKDYHGST HUS724030ALA640                    MF8OAA70   Slot Number: 3 Device Id: 6 Raw Size: 2.728 TB [0x15d50a3b0 Sectors] Firmware state: Online, Spun Up Inquiry Data:       PN2234P8JYP59YHGST HUS724030ALA640                    MF8OAA70 

Step 3 : Recover the Serial Number

The Device ID and Adapter ID will be used to tell smartctl which disk to look for in which RAID array.

The command should look like this:

 smartctl -d megaraid,N -a /dev/sdX | grep Serial Serial Number:    XXXXXXX 

The drive's Device ID

The RAID's Device : /dev/sda = 1st RAID, /dev/sdb = 2nd RAID, etc.

In some situation, you may receive this output:

 /dev/sda [megaraid_disk_00] [SAT]: Device open changed type from 'megaraid' to 'sat' 
You must then replace megaraid by sat+megaraid:
 smartctl -d sat+megaraid,N -a /dev/sdX | grep Serial Serial Number:    XXXXXXX 

LSI Controller

LSI RAID controller uses a module called sg-map which map devices in /dev/sgX (X being the number defining the device).

You can refer to this guide (LSI raid controller) to know which hard drive relate to a designed sg device.

Once you found the sg device related to the hard disk you want to query, use the following command:

 smartctl -a /dev/sgX | grep Serial Serial Number:    XXXXXXX 

The sg device number (Ex: /dev/sg0, /dev/sg1)