Disk space problem when using "vi"

This is a vexing problems for newbie Solaris users.

You try to edit a file with the standard Solaris vi and find yourself with this kind of message:

$ vi foobar.txt
 "There is not enough space in the file system."

What gives? Especially since the /home of the user still has plenty of free space left!

By default the vi shipped with Solaris creates backup files in the directory named /var/preserve. If /var is full, vi will throw up the message shown above.

The solution is therefore rather simple: make sure /var has enough space free, especially if you are editing large files with vi...

Please note that this also a problem under AIX. Same problem, same solution.

On the other hand, vim does not have these problems, since it creates its backup files in the directory where the file to be edited is present.

Hope this helps!