1832984 Members
3006 Online
110048 Solutions
New Discussion

/dev/zero on HP-UX 11

 
Christoph Plattner
Occasional Advisor

/dev/zero on HP-UX 11

Hello HP experts !

I use some versions of UNIXes,
but under HP-UX, I miss something
like '/dev/zero' a device producing
0x00 characters. I often use
this to wipe out devices with `dd',
etc...

Is there a similar device in HP-UX ?
What is '/dev/nuls' (the read is
blocking, when I try to use) ?

With friendly regards
Christoph Plattner

-------------------------
private:
christoph.plattner@gmx.at
company:
christoph.plattner@alcatel.at
Linux/UNIX-!FAN
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor

Re: /dev/zero on HP-UX 11

Yes there is but you may have to build it.

Do an ls /dev/zero.

If not found then we will build one.

cd /dev
mknod zero c 3 0x000004
chown bin:sys zero
chmod 666 zero

On 10.20, I think the correct minor device no. is 0x000003 but everything else is the same.

To test:
dd if=/dev/zero bs=1k count=2 of=/tmp/xx

That should create 1 2k zero'ed file.

Regards, Clay
If it ain't broke, I can fix that.
Vincenzo Restuccia
Honored Contributor

Re: /dev/zero on HP-UX 11

Steffi Jones_1
Esteemed Contributor

Re: /dev/zero on HP-UX 11

Hello,

I use /dev/null for those purposes.

If I test a disk for example I use dd if= .... of=/dev/null.

Hope that helps,

Steffi Jones
Klaus Crusius
Trusted Contributor

Re: /dev/zero on HP-UX 11


the correct command to create /dev/zero is

"mknod /dev/zero c 3 3"
There is a live before death!
Bryan Payne
Occasional Advisor

Re: /dev/zero on HP-UX 11

I don't think you want to use /dev/null as it's output is discarded. To test I used the dd command listed above:
dd if=/dev/null bs=1k count=2 of=/tmp/xx

When I used /dev/null the file length was zero, and of course contained no data.
dd listed:
0+0 records in
0+0 records out

Next I created /dev/zero using:
mknod /dev/zero c 3 4
chown bin:sys /dev/zero
chmod 666 /dev/zero

Then tested with
dd if=/dev/zero bs=1k count=2 of=/tmp/xx
dd listed:
2+0 records in
2+0 records out

This time /tmp/xx had size:
-rw-r--r-- 1 root sys 2048 Jul 11 11:12 /tmp/xx

This is probably what you want as it will over write the data that is on the disk instead of discarding the output.

I have seen some discrepancy with the minor numbers. I have an 11.0 workstation an it did not have a /dev/zero. On another 11i box fresh from the factory it has a /dev/zero and has minor of 4 instead of 3 that I've seen listed elsewhere. I used 4 in my test since that was on a fresh install of 11i. It may work with minor of 3 as well, but I didn't test. I tested using an 11.0 box.

For anyone that doesn't know mknod /dev/zero

I know this is an old thread, but wanted to clarify in case anyone else ran across this thread.

Bryan Payne
Senior Unix Admin
Levi Strauss
bryan_payne@yahoo.com
Bryan Payne
Occasional Advisor

Re: /dev/zero on HP-UX 11

Correction:
mknod /dev/zero

Should be:
mknod /dev/zero c