Can't I get a /dev/one?

Chris Adams cmadams at hiwaay.net
Wed Jul 14 11:36:30 UTC 2004


Once upon a time, William M. Quarles <walrus at bellsouth.net> said:
> So, if I'm trying to write all ones to a drive, I'd want to do this?
> tr '\00' '\77' </dev/zero >/dev/hdb

The backslash escapes are in octal, so you would want:

tr '\0' '\377' < /dev/zero > /dev/hdb

> Looks like that will take a lot longer than dd, because it's only 
> reading in one byte at a time.

The reading isn't really a problem, but the writing might be.  You could
pipe it through dd to get blocking like:

tr '\0' '\377' < /dev/zero | dd bs=1M of=/dev/hdb

> If you are suggesting that I try the complement function I don't see how 
> that helps.  Then again, I don't know what you are suggesting, since 
> "man tr" doesn't communicate anything other than, "you are ignorant Mr. 
> Quarles, go educate your self on this command called 'tr.'"  Well, I'm 
> not as ignorant as I was a few minutes ago, but I am still lost.  Could 
> you please volunteer a little more information now?

Sorry, didn't really mean to be that short; just kind of a reaction to
your "that's not what I want" short responses (but that isn't really an
excuse).  Between that and not having any sleep (not enough sleep Sunday
and Monday nights, last night I was on call and paged every 30 minutes
except when the thunderstorm came through and then had to come in at
3:30am to do system maintenance), I was kind of cranky.

The other nice thing about using the second command with "dd" above is
that you can send a USR1 signal to dd to get a progress report.  Go to
another console or window, find the PID of the dd command, and do "kill
-USR1 [dd pid]" and dd will print how far it has gotten (how many
blocks, which in the above example would be megabytes).
-- 
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.





More information about the fedora-list mailing list