Operating System - HP-UX
1845947 Members
3368 Online
110250 Solutions
New Discussion

Re: What does this command do?

 
SOLVED
Go to solution
Henry Chua
Super Advisor

What does this command do?

Out of curiosity, I been seeing people used this "dd if=/dev/dsk/C0t0d0s0 of=/dev/null bs=1024k" to check the physical condition of the harddisk. But how does it really check the disk is ok?

Thank u!
9 REPLIES 9
Rajeev  Shukla
Honored Contributor

Re: What does this command do?

Hi Henry,

It check the disk by reading the if=/dev/dsk/c0t0d0s0 option in dd means input file, and it reads in a block of 1024k and if there is any problem on the disk whcih prevents from reading the device, it reports an error.
So by running above command you are looking for any read errors on the device

Cheers
Rajeev
Henry Chua
Super Advisor

Re: What does this command do?

Thank u Rajeev,

But how does writing files to null checks the intergrity of the drive?
Sridhar Bhaskarla
Honored Contributor

Re: What does this command do?

Henry,

It's done by reading from the disk. 'if=/dev/rdsk/c0t0d0' will read from the disk and write into /dev/null. If any block is bad and is not readable, then the disk may be bad.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Rajeev  Shukla
Honored Contributor
Solution

Re: What does this command do?

Hi Henry,

Its not the write we are checking for by this command. And since we are reading from a device file we need to write somewhere, thats the reason why we are writing to /dev/null which means nothing.

So the point to note is that we are looking for reading the device not writing to device.
But if you like you can check the write also, but that will destory all the data you have on that disk, so writing is tested when the device is added new.
Bill Hassell
Honored Contributor

Re: What does this command do?

The vast majority of disks go bad with either bad spots on the disk (the disk hardware detects a parity error) or with an electronic failure where the disk cannot comunicate. There is no way to validate the actual data on the disk without another copy for comparison. So the dd command just reads the data, throws it away but checks for any error status.

Normally, this is not needed if you have the online diagnostics loaded and patched. Any problems with the disks will be reported in syslog.


Bill Hassell, sysadmin
Hein van den Heuvel
Honored Contributor

Re: What does this command do?

I'm a relatively frequent user of said command.

I rarely read the whole drive though, Just enough to make sure the data is coming form the real spindles, not from some controller cache. So I like to read say 100MB or 1GB and use bs=1024k count=100 for that.

I also tend to pre-fix with the 'time' command, such that I also get an impression of the raw disk IO speed.

In the rare occasions when I want to test raw writes, I use if=/dev/zero, but as pointed out this will destroy any existing data.

Hein.
Henry Chua
Super Advisor

Re: What does this command do?

Thank you guys for your advises.. Bill say something about diagnostic patches that can self report any detected error with the disk on syslog.. may I know how can I get my hands on this patches?
Cheryl Griffin
Honored Contributor

Re: What does this command do?

The Diagnostics and patches he is referring to can be found in this matrix
http://docs.hp.com/hpux/onlinedocs/diag/stm/stm_upd.htm#table

For your version that you have installed, read the README for the list of "Required and Recommended Patches"

To download the latest version of Diagnostics
http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=B6191AAE
"Downtime is a Crime."
Bill Hassell
Honored Contributor

Re: What does this command do?

Normally, the online diagnostics are loaded onto your new HP-UX computer. If you reloaded HP-UX (or someone else did), then you may not have the Support Tools Manager (STM) and associated diagnostics. They are critical to any HP-UX system since this is the only way that hardware errors will be logged in a meaningful way, as well as having the use of exercisers to test RAM, CPU, etc.

As mentioned, you can download the latest diagnostics from HP, or load them from your latest SupportPlus CDROM. In some cases, you'll need additional patches but these are on the CD or available from the HP ITRC. Once the diagnostics are correctly loaded and running, any errors including soft errors like correctable memory errors will be logged in syslog.


Bill Hassell, sysadmin