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.
- How To Check Hard Drive Serial Number Cmd
- Hitachi Hard Drive Serial Number Check
- Hp Hard Drive Serial Number Check
- Determine Hard Drive Serial Number Linux
- Volume Serial Number
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?
How To Check Hard Drive Serial Number Cmd
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 NiedermairHitachi Hard Drive Serial Number Check
16.5k77 gold badges6666 silver badges113113 bronze badges
dharm0usdharm0us5,5202222 gold badges7575 silver badges124124 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()
orexec()
- 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
Patrick GlandienPatrick Glandien$r = system('hdparm -I /dev/hda');
(replace hda with your hd) to get the serial number of a given hard drive.6,59555 gold badges3535 silver badges4646 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,48844 gold badges3333 silver badges6363 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 Heukelom21.6k5252 gold badges157157 silver badges278278 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:
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.
MrHusMrHus25.6k55 gold badges2525 silver badges3131 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.So, please choose one of the easy method on below Method 1: Installing App ManuallyPlease note: you should download and install programs only from trusted publishers and retail websites. First, open your favourite Web browser, you can use Chrome, firefox, Safari or any other. Puffin browser for windows 8.
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.
Hp Hard Drive Serial Number Check
Active9 months ago
I have multiple harddisks which get connected to my server and I'm not sure which one is what in the view of sdXY . If I can see the serial numbers of my harddisks from terminal, I can easily identify them.
Is there any way I can see them from terminal?
slm♦270k7777 gold badges588588 silver badges732732 bronze badges
rɑːdʒɑrɑːdʒɑ2,80677 gold badges2929 silver badges5454 bronze badges
8 Answers
Another solution which does not require root privileges:
udevadm info --query=all --name=/dev/sda | grep ID_SERIAL
Determine Hard Drive Serial Number Linux
This is actually the library that
lsblk
, mentioned by don_crissti, leverages, but my version of lsblk does not include the option for serial.JohannJohann
In terminal type:
EDIT: You can also use
lshw
or smartctl
- lshw
# lshw -class disk
- smartctl
# smartctl -i /dev/sda
If you are missing those tools, just install following packages
Community♦
Robert JonczyRobert Jonczy
Device1 name and corresponding serial number:
output:
add
-n
if you don't want to print the header line:output:
Pass
device
as argument to get only the serial number of a specific device:Volume Serial Number
output:
Keep in mind
In general, block devices are devices that store or hold data. Diskette drives, hard drives and CD-ROM drives are all block devices. But that's not a problem when using
don_crisstidon_crisstilsblk
lists information about all available (or the specified) block devices. Now, for those who do not know what that last term means:In general, block devices are devices that store or hold data. Diskette drives, hard drives and CD-ROM drives are all block devices. But that's not a problem when using
lsblk
as you can simply add more columns e.g type
(device type) and/or tran
(device transport type) etc:55.3k1818 gold badges153153 silver badges180180 bronze badges
By using
hdparm
you can see your Harddisk serial number from terminal.Open your terminal and type as
rɑːdʒɑrɑːdʒɑ
2,80677 gold badges2929 silver badges5454 bronze badges
This will show you the serial number against the familiar disk name.
Ed NevilleEd Neville
Easiest way I know (does not require root):
That outputs all disks, their serials, and any extra info. -p adds partitions. -l adds labels. -u adds UUID for the partitions.
Plus it's a lot easier to remember, heh.
Sample:
Note that this filters out optical drives. To see optical data:
Note that on my Debian system, lsblk does not show anything for serials, whether as root or user. Which is why inxi uses a much more reliable method to get that data.
As you can see, to lsblk, it thinks that an optical drive and floppy drive are also disks, which in a sense they are, though not really, since they don't become disks until a disk is inserted. And it shows nothing for serial, it also by the way shows nothing for other values, like label. Definitely a bug since this data is available to the system, that's where inxi gets it, direct.
LizardxLizardx
I also like using
user208145user208145ls -l /dev/disk/by-id
because it'll show a disk's WWN if available. The WWN is usually printed on the disk's label, so it's easy to identify.1,43622 gold badges1414 silver badges1717 bronze badges
This will show the
kemotepwwn-id
for the disk. The awk
filter may need to be adjusted depending on the OS distribution and version.I needed a scripted solution to read the wwn-id
, which is needed for Pacemaker disk fencing.If partitions (/dev/sdX1
e.g.) have already been created another grep
is needed to filter the output:3,20844 gold badges99 silver badges2828 bronze badges
tschakkatschakka