Unix Testing if disk is full

Everyone knows /dev/null, and most will know /dev/zero. But /dev/full was unknown to me until some time ago. This device will respond to any write request with ENOSPC, No space left on device. Handy if you want to test if your program catches "disk full" - just let it write there:

$ echo foo > /dev/full bash: echo: write error: No space left on device

pretty handy

Bojan Babic

2 comments:

  1. hehe, handy indeed.

    In case your OS doesn't have /dev/full (e.g. Solaris; /dev/full is Linux feature), you can make it (as root):

    mknod -m 666 /dev/full c 1 7
    chown root:root /dev/full

    ReplyDelete
  2. Now, post is more complete
    Thanks for insight :)

    ReplyDelete