dd command error writing No space left on device

Malatesh picture Malatesh · Oct 27, 2015 · Viewed 23.1k times · Source

I am new to storage, trying to erase the data in the device '/dev/sdcd' why should I get 'No space left error'

[root@ dev]# dd if=/dev/zero of=/dev/sdcd bs=4k
dd: error writing ‘/dev/sdcd’: No space left on device
1310721+0 records in
1310720+0 records out
5368709120 bytes (5.4 GB) copied, 19.7749 s, 271 MB/s
[root@ dev]# ls -l /dev/null
crw-rw-rw-. 1 root root 1, 3 Oct 27 01:35 /dev/null

if this is very basic question, I am sorry about that

Answer

paxdiablo picture paxdiablo · Oct 27, 2015

The /dev/zero device will continue to provide zeros for as long as you read from it, all the way to the heat death of the universe should your hardware last that long(a).

With your command, you have no limiting clause like count= so it will continue to read from /dev/zero and write to /dev/sdcd until the latter runs out of space.

It will still be writing to the device so you can safely ignore the error at the end (although it may be a good idea to ensure the disk is actually an integral multiple of the block size to avoid the possibility of leaving sensitive information at the end).


(a) It may slow down somewhat in the final stages, as it becomes harder to get useful work out of a universe that's losing all its energy gradients :-)