dd: writing '/dev/null': No space left on device
/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
Related videos on Youtube
Cees
Updated on September 18, 2022Comments
-
Cees over 1 year
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"
-
Admin over 11 yearscan you provide the output of
ls -l /dev/null
-
Admin over 11 years@Patrick added ls -l
-
Admin over 11 yearsCould you also copy/paste the dd command you're executing?
-
Admin over 11 years@forcefsck Done, added the command
-
Admin over 11 yearswhat happens if you use
time dd if="$filename" of=/dev/null
? BTW. dd also outputs time elapsed. -
Admin over 11 yearsThis 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 withouttime
? Please post the output ofstrace dd if=$filename of=/dev/null
(do it with a file containing no confidential information), or ofstrace dd if=$filename of=/dev/null
iftime
is needed to trigger the error. -
Admin over 11 years@Gilles Problem was that my /dev/null was not a character special file. I updated my question above.
-
-
miletliyusuf almost 11 yearsWow! you're a lifesaver. Thanks, this really helps. I never deleted null but it wasn't there, i created one manually.
-
Gilles 'SO- stop being evil' almost 11 years@Fr0zenFyr You probably have a script running as root that removes
/dev/null
in some circumstances, perhaps something liketmp_file=$(mktemp); … … … if [ "$mode" = "quiet" ]; then tmp_file=/dev/null; done; … … … rm "$tmp_file"