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
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 5m
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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 18 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
18 comments… add one
  • Deepan.R Apr 28, 2007 @ 11:02


    I too facing the File size limit exceeded error under Linux. But as per the above suggested solution, the ulimit is not setted for the user root, in my case. But still Im getting the error while I connect my USB Hard Drive and try to copy files. No file can be copied more than 4.1GB…I need to copy some 23 GB files and I still have the space in USB.

    Kindly inform me what can I do….Mean while, I am aslo searching the web for a solution.


  • Chris Sep 5, 2007 @ 17:21


    This is probably due to the filesystem that your hard drive is formatted to. Each filesystem has a file size limit of its own. Chances are that the hard drive is formatted as FAT32, which has a 4GB max filesize. If you need it to be able to deal with larger files, consider reformatting to ext3(with a limit of between 16GB to 2 TB)) or something else.

  • Mani Sep 20, 2007 @ 14:41

    I tried as per your suggestion.The explanation is very good. It worked well for me. Thanks a lot.


  • Purna Apr 24, 2008 @ 3:37

    try this command.
    #dd if=/dev/zero of=/filesize bs=1024 count=xxxx // to create large file.
    If this helps you to create expected filesize then filesystem/os does not limits you.

    To create this sort of filesize you have to use LFS. becoz bydefault 32bit compilation is able to address at most 2^31 bytes(2GB).
    1. open file with O_LARGEFILE flag or’ed with other falgs.

  • Vasant Dec 15, 2008 @ 12:27

    suggestion of converting usb hdd to ext3 format is good. but that format will not be detected in windows xp. so how to come out this problem.

  • Stephen Apr 9, 2009 @ 22:02

    I ran into this, where the apparent limit was 16 GB. To cope with lots of little files, i’d gone out of my way to set up the ext3 filesystem with 1 KB blocks. ext3 with 1 KB blocks limits files to 16 GB. Here’s the schedule:

    Ubuntu itself does not have file size limits — It depends what file system you are using the standard is ext3. My drive was under 256GB, so i went with 2 KB blocks.

    Filesystem File Size Limit Filesystem Size Limit
    ext2/ext3 with 1 KiB blocksize 16448 MiB (~ 16 GiB) 2048 GiB (= 2 TiB)
    ext2/3 with 2 KiB blocksize 256 GiB 8192 GiB (= 8 TiB)
    ext2/3 with 4 KiB blocksize 2048 GiB (= 2 TiB) 8192 GiB (= 8 TiB)
    ext2/3 with 8 KiB blocksize (Systems with 8 KiB pages like Alpha only) 65568 GiB (~ 64 TiB) 32768 GiB (= 32 TiB)
    ReiserFS 3.5 2 GiB 16384 GiB (= 16 TiB)
    ReiserFS 3.6 (as in Linux 2.4) 1 EiB 16384 GiB (= 16 TiB)
    XFS 8 EiB 8 EiB
    JFS with 512 Bytes blocksize 8 EiB 512 TiB
    JFS with 4KiB blocksize 8 EiB 4 PiB
    NFSv2 (client side) 2 GiB 8 EiB
    NFSv3 (client side) 8 EiB 8 EiB

  • Sam Jul 16, 2009 @ 17:36

    I love this Q & A stream. I had the file size limit problem and was able to quickly try all the tests proposed here. It is quite clearly a problem with the program I was using. (SoX as it happens.)

    Thanks for an excellent diagnosis!

  • IvyAlice Jul 21, 2009 @ 14:47

    What I’m supposed to do when i got this message(when i’m root and i try to copy a too large file, I suppose) but an empty /etc/security/limits.conf file ? (not really empty, but just some comments)

  • Charanjit Singh May 1, 2010 @ 18:53

    Hi Chris

    Thanks I was also facing the same problem I formatted my USB HDD with ext3 fs after it solved my problem Thanks a ton. I have partition my drive into two part one I had formatted with ext3 (space 120 GB) for testing purpose and rest partition I will format with NTFS (with space 190 GB)and will check again whether this problem will solve in NTFS filesystem or not.

  • sapy Jun 24, 2011 @ 9:29

    what is the entry for root max file size limit to 10 GB?
    Thanks in advance.

  • jitta Apr 13, 2012 @ 14:21

    Hi sir i am configure samba in Linux, sir my problem the Linux server so many clients send and receiving files . sir my problem any user send the data but server limit 1gb, no copy and paste 1GB more…. please tell me my problem.

  • sanjay Aug 29, 2012 @ 15:00

    If you want OS level file max limit. Add this line in the bottom of /etc/sysctl.conf as root

    fs.file-max =

    Then load the kernel module ; sysctl -p

  • Oleg Jun 16, 2013 @ 19:17

    Had similar issue, after long day, found what is causing it and it was xdebug.
    Issue was caused by this value xdebug.auto_trace=On

    • nicola Sep 2, 2013 @ 9:38

      thanks Oleg, your tip save me a lot of time…

  • Mark Jul 13, 2013 @ 15:33

    Simply run “ulimit -f unlimited” and it will set file size to unlimited. No need to go through this ordeal.

  • kesh Dec 24, 2014 @ 13:40

    thanks Mark
    it worked

  • Fábio Feb 24, 2016 @ 19:22

    Thanks Brother…

  • Aria Jun 15, 2016 @ 9:33

    I have set following 135MB limit on /etc/security/limits.d/50-fsize.conf on my SFTP server in centos 5.11
    @groupname hard fsize 135000
    However, when I try to SFTP from linux client, I get message “connection closed”
    I would like to receive a customize message something like “You have exceeded file limit for uploading”
    Is this configurable under limits.conf

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum