29-05-2021

  1. Hard Drive Serial Number
  2. Hard Drive Serial Number
  3. Hard Drive Serial Number Windows
  4. Change Hard Drive Serial Number

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?

The drive's (hardware) serial number is generally embedded into the firmware of the drive and is not something that can easily (if at all) be modified. Depending on the format of the drive, the OS may also embed its own serial number during a full format process on the drive. Hard Disk Serial Number Changer, free and safe download. Hard Disk Serial Number Changer latest version: Change your hard drive serial number effortlessly!

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.

dharm0usdharm0us

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

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 ॐ

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

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:

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
Hard Drive Serial Number

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.

Hard Drive Serial Number

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
Fery WardiyantoFery Wardiyanto

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

A volume serial number, sometimes seen as VSN, is a unique, hexadecimal number assigned to a drive during the creation of the file system during the format process.

The volume serial number is stored in the disk parameter block part of the volume boot record.

How to find hard drive serial number

Hard Drive Serial Number

Microsoft and IBM added the volume serial number to the format process in 1987 when they were working together to develop the OS/2 operating system.

A drive's volume serial number is not the same as the serial number of the hard drive, floppy disc, flash drive, etc. assigned by the manufacturer.

How Is the Volume Serial Number Generated?

A volume serial number is created based on a fairly complex combination of the year, hour, month, second, and hundredth of a second that the drive was formatted.

Because the volume serial number is generated during the format, it will change each time the drive is formatted.

How to View a Drive's Volume Serial Number

One of the easiest ways to view a drive's volume serial number is via Command Prompt, using the vol command. Just execute it without any options and you'll see both the volume serial number, as well as the volume label.

Duplicate Volume Serial Numbers

Since volume serial numbers are not generated at random and without knowledge of the volume serial numbers on other drives in the computer, there's a chance that two drives on the same computer could end up having the same volume serial number.

While the probability of two drives in a single computer getting the same volume serial number is technically possible, the chance is infinitesimally small and isn't usually a concern.

The only somewhat common reason why you might run into two drives in the same computer with identical volume serial numbers is when you've cloned one drive to another and are using them both at the same time.

Are Duplicate Volume Serial Numbers a Problem?

Duplicate volume serial numbers are not an issue for Windows or other operating systems. Windows will not be confused as to which drive is which if two drives have the same volume serial numbers.

In fact, the volume serial number is used by some software licensing schemes to make sure that an installed copy of the software is being used on the correct computer. When cloning a drive, and the volume serial number remains, it helps ensure that the software you run on the new drive works as you'd expect.

Another piece of data called the disk signature, part of the master boot record, is the truly unique identifier for a hard drive in a computer system.

Changing a Drive's Volume Serial Number

While there's no built-in ability in Windows to change a drive's volume serial number, there are some free, third-party tools that will do the trick.

Your best choice is probably Volume Serial Number Changer, a free, open-source program that shows you some basic information about your hard drive, plus a small field to enter the new volume serial number you want to set.

Hard Drive Serial Number

Another option is Volume Serial Number Editor. This program is very similar to Volume Serial Number Changer but this one isn't free.

Advanced Reading on Volume Serial Numbers

Hard Drive Serial Number Windows

If you're interested in finding out more about how volume serial numbers are generated, or how you might be able to tell something about a formatted drive by deciphering the number, we recommending checking out this Digital Detective's whitepaper: Volume Serial Numbers and Format Date/Time Verification [PDF]

Change Hard Drive Serial Number

There's more in that paper about the history of the volume serial number, as well as how to view it directly from the boot sector.