Operating System - HP-UX
1824937 Members
3967 Online
109678 Solutions
New Discussion юеВ

How to fill a device file with zeroes

 
SOLVED
Go to solution
Jdamian
Respected Contributor

How to fill a device file with zeroes

Is there any way to fill a device file with zeroes or other value ?

I need something similar to /dev/zero from Linux.

According to man pages, I cannot use "prealloc" command in a device file.

Thanx in advance.

P.D: My purpose is to erase any trace of confidential data in a raw disk.
5 REPLIES 5
Printaporn_1
Esteemed Contributor

Re: How to fill a device file with zeroes

Hi,

I don't understand the question ,
just wanna guess what you want.

- to empty a file
#> filename
empty content of file but the file name still exist.
- null device file is /dev/null
- if you want to scrap the disk
#dd if=some large files of=/dev/dsk/...
but this is very dangerous !!!!

enjoy any little thing in my life
Andreas Voss
Honored Contributor

Re: How to fill a device file with zeroes

Hi,

here my suggestion:

prealloc /var/tmp/zero 65536
while :
do
cat /var/tmp/zero
done | dd of=/dev/rdsk/c#t#d0 bs=64k

This will write to raw device until dd gets an I/O error (which means the disk is full written)

Be careful with the device to prevent writing to a wrong disk.

Regards
Carlos Fernandez Riera
Honored Contributor
Solution

Re: How to fill a device file with zeroes


Hola hola hola:

Easy :

see note http://europe-support.external.hp.com/cki/bin/doc.pl/sid=42a841b019c125f148/screen=ckiDisplayDocument?docId=200000052634178

if you cant read it , create /dev/zero :
mknod /dev/zero c 3 0x000003

unsupported
Bill McNAMARA_1
Honored Contributor

Re: How to fill a device file with zeroes

then I presume
dd if=/dev/zero of=/dev/dsk/c#t#d#

has anyone verified this, sounds interesting.

Later,
Bill (no free disk space !)
It works for me (tm)
Carlos Fernandez Riera
Honored Contributor

Re: How to fill a device file with zeroes

Hi Bill:

use rdsk better.

Yes, this special file exists in others Unix and runs perfectly.

After mknod check it with

dd if=/dev/zero of=/tmp/zeros bs=1k count=10




unsupported