[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /dev/null > /dev/sdb1 !



On 2008-04-22 18:13 +0200, Jordi Gutiérrez Hermoso wrote:

> On 22/04/2008, Sven Joachim <svenjoac@gmx.de> wrote:
>> No, you would only zero out the disk if you cat /dev/zero to it.
>>  Catting /dev/null immediately returns and does nothing.
>
> Hm at least catting /dev/null to a full file makes the file now be 0
> bytes long.

That's because the shell opens the file with the O_TRUNC flag.  If you
try the same with a device file, nothing happens because O_TRUNC is
ignored then.  See open(2).

> I'm not going to test what it does to my hard drive, of
> course. ;-)

If you still have a floppy drive, you can test with that, this is what I
did.

Sven


Reply to: