1834798 Members
2653 Online
110070 Solutions
New Discussion

Device Erase

 
SOLVED
Go to solution
Alex Green
Frequent Advisor

Device Erase

Hey,

I've just been watching the hpux newsgroup and I was wondering if someone could confirm if the following command would work to blank a tape device.

cp /dev/null /dev/rmt/0m

As I am fairly sure it used to work on solaris.

All comment appreciated.

Thnx
"The physicist's greatest tool is his wastebasket." - Albert Einstein.
7 REPLIES 7
harry d brown jr
Honored Contributor
Solution

Re: Device Erase

It will copy ONE null to the device. If you want more than one NULL, then use:

dd if=/dev/null of=/dev/rmt/0m bs=512 count=numberofpotentialblocksondevice


or do a man on "mediainit".

live free or die
harry
Live Free or Die
Alex Green
Frequent Advisor

Re: Device Erase

Does a block size or a count, have to be specified?
"The physicist's greatest tool is his wastebasket." - Albert Einstein.
Patrick Wallek
Honored Contributor

Re: Device Erase

NO!!!! I would not do a 'cp /dev/null /dev/rmt/0m' That would probably overwrite your /dev/rmt/0m file with the /dev/null device file. That is NOT what you want.

To scratch a tar or fbackup tape, you can just reuse it and all data will be overwritten.
harry d brown jr
Honored Contributor

Re: Device Erase

I was just thinking about what if you have a tape device that is doing compression (most do), how would it treat a huge string of nulls, anyways if I had a 24gb dds3 tape, and I wanted to erase it, I'd set my dd command like this:

dd if=/dev/null of=/dev/rmt/0m bs=1024 count=24000000

It's ok if the tape write fails with an IO error (it hit the EOT marker).

If it's a disk the same rules apply, but at least with a disk you can get specs on block sizes and overall disk size.

live free or die
harry
Live Free or Die
A. Clay Stephenson
Acclaimed Contributor

Re: Device Erase

Hi Alex:

You need a device that will supply an unlimited supply of NUL's. That is /dev/zero.
Do an ls -l /dev/zero to see if you have such a device. If not, create one thusly:
mknod /dev/zero c 3 0x000003. Chmod 444 /dev/zero.

If you then use this device rather than /dev/null, you can use your command. However, there is one wrinkle here, if this is a compression device and you write a ton of NUL's, what does that actually write to the tape? If possible, use a non-compression tape device node.

Regards, Clay
If it ain't broke, I can fix that.
Alex Green
Frequent Advisor

Re: Device Erase

Thanks all, I now have a clear path of action to follow.

:)
"The physicist's greatest tool is his wastebasket." - Albert Einstein.
harry d brown jr
Honored Contributor

Re: Device Erase

Clay,

You are right, what the hell was I thinking about (/dev/null), it must be a monday?? Alex, use the /dev/zero device!

live free or die
harry
Live Free or Die