Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am reading a 550MB file into /dev/null and I am getting

dd: writing '/dev/null': No space left on device

I was surprised. I thought /dev/null is a black hole where you can send as much as you want ( because its a virtual fs).

Yes my disk is almost full when I get this error. What can I do other than deleting content from the disk?

 ls -l /dev/null
 -rw-r--r--    1 root     root             0 July 7 21:58 /dev/null

Instead of

 crw-rw-rw-    1 root     root        1,   3 July 7 02:58 /dev/null

Command I am using:

time sh -c "dd if=$filename of=/dev/null"
share|improve this question
can you provide the output of ls -l /dev/null – Patrick Aug 13 '12 at 21:03
@Patrick added ls -l – abc Aug 13 '12 at 21:16
Could you also copy/paste the dd command you're executing? – forcefsck Aug 13 '12 at 21:21
This is indeed weird. Writing to /dev/null should never trigger this error, since it doesn't actually write anything anywhere. Do you get the same effect without time? Please post the output of strace dd if=$filename of=/dev/null (do it with a file containing no confidential information), or of strace dd if=$filename of=/dev/null if time is needed to trigger the error. – Gilles Aug 13 '12 at 22:57
@Gilles Problem was that my /dev/null was not a character special file. I updated my question above. – abc Aug 13 '12 at 23:21

/dev/null is a special file, of type character device. The driver for that character device ignores whatever you try to write to the device and writes are always successful. If a write to /dev/null fails, it means that you've somehow managed to remove the proper /dev/null and replace it by a regular file. You might have accidentally removed /dev/null; then the next … >/dev/null would have recreated it as a regular file.

Run ls -l /dev/null and check that the line looks something like

crw-rw-rw- 1 root root 1, 3 Sep 13  2011 /dev/null

It must begin with crw-rw-rw-: c for a character device, and permissions that allow everyone to read and write. The file should be owned by root, though it isn't very important. The two numbers after the owner and group identify the device (major and minor device number). Above I show the values under Linux; different unix variants have different values. The date is typically either the date when the system was installed or the date of the last reboot and doesn't matter.

If you need to recreate the file, some systems provide a MAKEDEV commmands, either in root's PATH or in /dev. Run cd /dev; ./MAKEDEV std or something like this to recreate the standard basic devices such as /dev/null. Or create the device manually, supplying the correct device numbers; on Linux, that's

mknod -m 666 /dev/null c 1 3
share|improve this answer
Wow! you're a lifesaver. Thanks, this really helps. I never deleted null but it wasn't there, i created one manually. – Fr0zenFyr Jun 24 '13 at 12:23
@Fr0zenFyr You probably have a script running as root that removes /dev/null in some circumstances, perhaps something like tmp_file=$(mktemp); … … … if [ "$mode" = "quiet" ]; then tmp_file=/dev/null; done; … … … rm "$tmp_file" – Gilles Jun 24 '13 at 13:59
I'll have to check my scripts then, if this is true, there is a chance that null will be deleted again. I'll come back if i'm unable to locate(solve) this situation. Thanks for the heads up. Cheers!! :) – Fr0zenFyr Jun 25 '13 at 4:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.