Operating System - HP-UX
1833601 Members
4052 Online
110061 Solutions
New Discussion

Re: How to limit file size for vi

 
Carlo Montanari
Advisor

How to limit file size for vi

Hi all. vi uses to put his temp file under /var/tmp, exposing a critical filesystem, /var, to the risk of saturation. My users have the bad habit to use vi with *VERY* big files, so I'm searching for a method to limit their size.
Does anybody know some trick about it?
7 REPLIES 7
Rajeev  Shukla
Honored Contributor

Re: How to limit file size for vi

how about assigning quota to users in this directory..
Assign some very less quota to each users who normaly use large files to vi and see how it goes.

Rajeev
Armin Feller
Honored Contributor

Re: How to limit file size for vi

The vi filesize limit is 32Mbyte.


From manpage of vi(1):

Maximum Line Length
LINE_MAX characters (defined in ), including 2-3 bytes
for overhead. Thus, if the value specified for LINE_MAX is 2048,
a line length up to 2044 characters should cause no problem.


Best regards,
Armin
T G Manikandan
Honored Contributor

Re: How to limit file size for vi

Yes ofcourse you can do this

you can set TMPDIR to /tmp in .exrc

.exrc file is the initialization file for vi
T G Manikandan
Honored Contributor

Re: How to limit file size for vi

making changes in .exrc will only result for temporary vi files to be placed somewhere.
Incase you are looking at moving all temporary working dir
then you can set the TMPDIR in the user environment to the directory you wish so that his temporary files will be stored there.
For global setting make sure that you make entry in the /etc/profile for ksh and sh and /etc/csh.login for csh shell.

REvert
Vincent Stedema
Esteemed Contributor

Re: How to limit file size for vi

If you have free space available in one of you vg's, you can set up a seperate lvol and mount it at /var/tmp. That way it doesn't matter if files in /var/tmp take up much space.

Regards,

Vincent
Carlo Montanari
Advisor

Re: How to limit file size for vi

Thanks all for your quick replies. As long as possible I'd prefer not to use quotas: this isn't a general disk usage problem, it's specific of vi. People simply don't realize that by using vi on a big file they are creating another one in a critical place.
From your replies I see that the most recommended solution is to move the temp files elsewhere (dir or lvol). Not ideal, but acceptable. Yet, it's important for me to isolate vi from other programs. If users need, say, to sort files, I don't want them to compete for space with vi's shadow files: so
TMPDIR variable would be a good solution, but it's shared with too many other pgms.
T G Manikandan
Honored Contributor

Re: How to limit file size for vi

Just for vi programs you can put TMPDIR inside .exrc.