lost and found ( for me ? )

/dev/full : always full device

small tips.
You can check how your program handles disk-full errors by using /dev/full device.

from man manual.
root@ubuntu:~# man full

DESCRIPTION
      File /dev/full has major device number 1 and minor device number 7.

      Writes to the /dev/full device will fail with an  ENOSPC  error.   This
      can be used to test how a program handles disk-full errors.

      Reads from the /dev/full device will return \0 characters.

      Seeks on /dev/full will always succeed.

sample usage.
root@ubuntu:~# tail -1 /etc/lsb-release ;uname -ri
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
3.13.0-24-generic x86_64

root@ubuntu:~# echo hello > /dev/full
-su: echo: write error: No space left on device
root@ubuntu:~# echo $?
1
root@ubuntu:~#
root@ubuntu:~# echo hello > /dev/null
root@ubuntu:~# echo $?
0

I didn’t know that..

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.