/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.
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
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
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