Re: How to restrict the maximum size of single file can be opened (195 Views)
Reply
Advisor
Senthil_N
Posts: 28
Registered: ‎03-04-2013
Message 1 of 2 (222 Views)

How to restrict the maximum size of single file can be opened

Hi All,

 

There is only Linux server where swap is configured with 8gb. one day some one opened a log file (size is more than 8gb) using vi editior. the server got hung. we would like to prevent same kind of issue happening again. So that, I need to know how to prevent one file from opening through vi editor if the file size  is more than 8gb.

Honored Contributor
Goran Koruga
Posts: 1,324
Registered: ‎12-05-2002
Message 2 of 2 (195 Views)

Re: How to restrict the maximum size of single file can be opened

Hello.

 

You can set data size limit for a process -- man setrlimit.

 

To experiment with it, use shell built-in 'ulimit' to set the limits (typically "ulimit -d").

 

I would also recommend to disable memory overcommit (check kernel documentation, namely "sysctl/vm.txt" file).

 

Regards,

     Goran

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.