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

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



Michelle Konzack wrote:
Am 2008-04-25 01:21:39, schrieb Rafael Fontenelle:
Strange. I set a virtual machine with an extra harddisk and I just ran 'cat
/dev/null > /dev/hdd' as root with /dev/hdd3 umounted in the first attempt
and then mounted in the second, but nothing happened with my partition or
the whole virtual disk. See the output below:

rffdebian01:/# cat /dev/null > /dev/hdd
rffdebian01:/# cd /mnt/hdd3/
rffdebian01:/mnt/hdd3# ls
file
rffdebian01:/mnt/hdd3#

It seems that /dev/null really returned _nothing_. Very different from 'cat
/dev/zero > /dev/hdd'. This one really formated the virtual harddisk,
cleaning incl. the partition table (I had to remake the partitions with
cfdisk). Also displayed a message after completing the harddisk with zeros.

rffdebian01:/# umount /dev/hdd3 && cat /dev/zero > /dev/hdd
cat: write error: No space left on device
rffdebian01:/#

    dd if=/dev/zero of=/dev/hdd bs=1M


I don't understand the point you're trying to make, unless it is to just give an alternate way to do the same thing?

Yes, the dd command given will also write zeros to the device. Same as the "cat /dev/zero > /dev/hdd" does.

And, both commands generate the same basic output error (different words, same issue):

  cat: write error [No space left on device]

  dd: writing `/dev/fd0': No space left on device

This is because 'cat' only knows to stop when input reaches EOF, which /dev/zero never gives, and dd will only stop if you tell it how many blocks to write, as in:

  dd if=/dev/zero of=/dev/fd0 bs=18k count=80

The error messages in the first two cases are simply the response of the disk driver to the fact that it has moved the read/write head to the end of the disk and can't go any farther, even though both commands try to.

--
Bob McGowan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: