File Size Limit Exceeded Error Under Linux and Solution

I am trying to copy a file called act.dat. I do have enough disk space to copy this file. I am getting an error “file size limit exceeded” under Linux. How do I get rid of this error?

Your system administrator must have imposed limitation on your account for file size creation. You need to use the ulimit command to find out file size limitation. This command provides control over the resources available to processes started by the shell, on systems that allow such control.

Task: Find out the current resources available to your shell / account

Open the Terminal and then type the following command:
ulimit -a
Sample outputs:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) 5000
pending signals                 (-i) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) unlimited
max rt priority                 (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2047
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

The above output clearly stat that you can create file size upto 5MB limit. To change this limit or if you do not wish to have a limit you can edit your /etc/security/limits.conf file (login as the root):
# vi /etc/security/limits.conf
Look for your username and fsize parameter. Delete this line or set new parameter. For example consider following entry where I am setting new file size limit to 1 GB:

vivek       hard  fsize  1024000

Save the changes. Log out and log back in for the changes to take effect.

Now, your limit is 1GB file size. If you do not want any limit remove fsize from /etc/security/limits.conf.

See also

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.