Operating System - HP-UX
1826050 Members
4202 Online
109690 Solutions
New Discussion

Format an Hard drive under HP-UX

 
SOLVED
Go to solution
Yan Berube
Occasional Contributor

Format an Hard drive under HP-UX

I need to send back some WS to a supplier. How I can erase all data on each hard drive quickly ? Do we have a somethings in unix like "format c:" in wintel ?

Thanks
7 REPLIES 7
Jeff Schussele
Honored Contributor

Re: Format an Hard drive under HP-UX

Hi Yan,

Yes - the mediainit command.
But it's not recommended for drives you wish to keep, however, nor for drives with especially sensitive data as there are more secure techniques.
Commands would be like:

mediainit /dev/rdsk/cXtYdZ

Note the need for the raw device.

man mediainit for details

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven Sim Kok Leong
Honored Contributor

Re: Format an Hard drive under HP-UX

Hi,

Another way is to erase the data is to dd the /dev/dsk/c?t?d? with zeros etc e.g.

# dd if=/dev/zero of=/dev/dsk/c1t2d0 bs=1024

Hope this helps. Regards.

Steven Sim Kok Leong
MANOJ SRIVASTAVA
Honored Contributor

Re: Format an Hard drive under HP-UX

writing a string at the start of the hard disk will do the job

cat < file name > > /dev/dsk/c0t0d0 will write the file at the start of the disk hence invalidating the format , you can also use mediainit to do the same.

Manoj Srivastava
David Ritchie
Frequent Advisor

Re: Format an Hard drive under HP-UX


mediainit performs a low-level (i.e. at the SCSI level) format. For most people, this is sufficent.

dd'ing over the front of the disk is not sufficent - if you have confidential data on the disk, bad guy could do something like

dd if=/dev/dsk/c1t0d0 bs=4k | strings | grep '[0-9]*-[0-9]'

to look for phone numbers and social security numbers (as an example) on the disk ....

even mediainit'ing is not completely secure - if bad guy takes the mechanism to a data recovery facility, they can often recover data by reading each of the tracks 'off-center' of the primary servo data... not trivial, not impossible either. Multiple
mediainits make this less likely to be successful.

It really depends on your level of paranoia. The military does not throw away drives at all - the drives are just ran through a crusher when the equipment is obsoleted...

-- Dave Ritchie

Stefan Farrelly
Honored Contributor
Solution

Re: Format an Hard drive under HP-UX

You want this; it writes random numbers from 1 to 255, all you do is add a pipe then dd of=/dev/rdsk/cxxxxx to write random numbers to the entire disk until it ends.

perl -e 'srand(time() ^ $$); while (1) { print int(rand(1)*256); }'
Im from Palmerston North, New Zealand, but somehow ended up in London...
David Ritchie
Frequent Advisor

Re: Format an Hard drive under HP-UX

Hi, can you assign points to this thread and close it out if it answer your question? Thanks...

-- Dave
Yan Berube
Occasional Contributor

Re: Format an Hard drive under HP-UX

Thanks !