Check Hard Drive Serial Number

Posted on by
Check Hard Drive Serial Number Average ratng: 4,4/5 9038 votes
Western

How to find out a hard disk model and serial number on Linux?

Here are few quick ways

Info in /proc/scsi/scsi

Use any one of the following command from shell prompt to find out hard disk model number:

  1. If your drive is connected to your computer: Seagate has created a very simple tool that will tell you the serial number and the model number of any and all Seagate, Samsung and Maxtor-brand drives connected in or to your computer. Use the DriveDetect.exe method to find both numbers. You can also use SeaTools to display each number.
  2. IBM compatible users. Commonly, the CMOS will list the hard drive's serial number, model number, cylinders, heads, sectors, and the size of the hard drive. Note: If the CMOS is not configured to auto detect the hard drive, it is important to note that the hard drive values may not be correct.
  3. Sep 07, 2018  Check the hard drive serial number in Windows 10 via Command Prompt. To check the hard drive serial number in Windows 10 via Command Prompt, first and foremost, open Command Prompt and type the following command. Wmic diskdrive get SerialNumber. After hitting enter, you should see the following output.
  4. How to Find Serial Number of Hard Drive in Windows Option One: To Find Serial Number of Hard Drive on Manufacturing Label. Option Two: To Find Serial Number of Hard Drives in Command Prompt. Option Three: To Find Serial Number of Hard Drives in PowerShell.

. As: type the drive of the disk (drive or volume) that we want to change the VSN ('C:'). As xxxx-xxxx: type the new Volume Serial Number (e.g. In this example I want to change the VSN of disk C: and I have changed only one character (the first) of the old VSN to specify the new one.

scsi_id

Use scsi_id command to querys a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or 0x83 and uses the resulting data to generate a value that is unique across all SCSI devices that properly support page 0x80 or page 0x83.

OR on RHEL7

lsscsi command

lsscsi gets information from /proc/scsi/scsi

lsblk command

lsblk '-S' option shows scsi info about SCSI devices

sginfo command

'-M' option Access manufacturer defaults instead of current values

'-m' option Access modifiable fields instead of current values

'-i' option, Display information from INQUIRY command

User Reactions. Yahoo games typer shark free. - - - - -2019-09-18. who’s down for F4f?

'-s' option, Display serial number (from INQUIRY VPD page)

# sginfo -s /dev/sda
Serial Number '9QJ53A27

'-a' option, Display inquiry info, serial # and all mode pages

Active1 year, 11 months ago

Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP : How can it be done?I want to store it in a file.

OS : windows 2000,XP,ME,Vista..

Yes, I want the serial number of the hard drive of the Server.

Or can it be done through Adobe AIR?Or can it be done through a C program on Windows?

Is this number : BC16-5d5f unique for a hard drive?How is it different from the manufacturer given serial number?

Displays only the following text on my Vista Machine:

SerialNumber

On my XP machine, the command is unrecognized.

Andreas Niedermair
16.5k7 gold badges66 silver badges113 bronze badges
dharm0usdharm0us
5,52022 gold badges75 silver badges124 bronze badges

9 Answers

The following returns the disk serial number. Should work with multiple drives, you'll just get multiple results. Just run it with shell_exec.

wmic.exe is located in your windows system32 folder. And wmic does exist on WinXP, Ive used it there myself.

My result on Vista:

I do not know if all harddrives provides the serial number to the OS.

It seems the wmic command is only available on the professional versions of Windows XP, Windows Vista and Windows 7.

OISOIS

PHP itself has no way of accessing the hardware like that.

You will have to either

  • use a command of your operating system and call it with system() or exec()
  • write an extension for PHP that will return you the information

If you are on Linux and have the necessary privileges and configuration you can use $r = system('hdparm -I /dev/hda'); (replace hda with your hd) to get the serial number of a given hard drive.

Patrick GlandienPatrick Glandien
6,5955 gold badges35 silver badges46 bronze badges

that's on linux, not sure on windows though. You could execute that via 'system()'

Have a look at http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.hk.msdn.connection&tid=e41f0af2-2e76-4be6-9b7b-636e79ac0491&cat=zh_HK_3b03d742-993a-4f96-accd-1063c6bfd559&lang=zh&cr=HK&sloc=&p=1

Might be a way forward.

Also, when I ran a 'dir' on the command prompt, it shows:

Is that what you're looking for?

Andrei Serdeliuc ॐAndrei Serdeliuc ॐ
4,4884 gold badges33 silver badges63 bronze badges

I can't tell you the answer, but I guess you'll have to look in the direction of extensions (maybe even writing one yourself). I doubt this is something PHP's core has.

Edit: I forgot about the raw power of 'exec' :-/

Bart van HeukelomBart van Heukelom
21.6k52 gold badges157 silver badges278 bronze badges

Run the following with shell_exec (test in command prompt if needed):

DISKDRIVE doesn't get the actual serial number for my drive that shows plugged in through an IDE channel. the above seemed to get the actual serial numbers for all of my drives. Tag will also return you what type of drive it is which may be helpful for identifying different drives.

Example output:

Check
Dustin GDustin G

Do you want the hard drive from the server or a client? PHP runs on the server so getting it straight from the client doens't seem possible to me.

The manual suggest you can execute commands on you server:http://nl2.php.net/manual/en/ref.exec.php

Unfortunately I don't enough Unix to get you hdd serials.

MrHusMrHus
25.6k5 gold badges25 silver badges31 bronze badges

You can use

or

Then you can echo it.

Based on Patrick Daryll Glandien's hint, you can execute following on *nix based machines. $hdserial= hdparm -I /dev/hda

hdparm -i /dev/sda returns lesser info. But as hdparm needs root access, it did not run with php for me.

The '2>&1' part is used from the suggestion here.

Community
LeninLenin
Veeren SharmaVeeren Sharma

On *nix based machine you can also use ls /dev/disk/by-id/ because hdparm need root permission (see Patrick Daryll G. answer).

and you will get something like this

Community

How To Check Hard Drive Serial Number Synology

Fery WardiyantoFery Wardiyanto

Hitachi Hard Drive Serial Number Check

Not the answer you're looking for? Browse other questions tagged phphard-driveserial-number or ask your own question.