Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a new USB Flash drive, 16GB. I am trying to copy a folder from my local drive to this flash drive. The folder I am trying to copy contains about 225000 4KB files. I have tried to copy using the folder GUI and with terminal. Both times it copies exactly 21844 files and then I get the error:

"cannot create regular file `filename': No space left on device"

I also have a compressed copy of the files and I have tried extracting this directly into the USB drive, again stopping after 21844 files.

I have looked for possible solutions and tried emptying the trash but that does not solve the issue. I have also formatted the drive to FAT32 and tried again, but that doesn't work. Does anyone have any suggestions?

I am running Ubuntu 12.04 and the USB drive is an ADATA S107.

share|improve this question

There are two ways to run out of space on a filesystem: 1)Actually running out of space for the data 2)Running out of some filesytem resource like inodes or fat table entries. Lots of little files may cause running out of inodes -- the filesystems are built with a default number of inodes and that may not meet your needs. The FAT32 filesystem is limited to 64k files per directory (max, long names will reduce that), so that will not work for you unless you combine the small files with an archiver like tar before you copy them. The archiver approach should work for any case, and will certainly reduce the stress on the flash memory -- think of the number of writes the directory block may get while being built, and hope the drivers are smart about buffering. Maybe you should put the same type of filesystem on the 16G stick as you have on your hard drive? (I'm guessing ntfs, since its directory limit is over 4 million). You can run mke2fs with switches to change the default inode size/number. Run the manual pages

man mke2fs

for a full description. The other possibility is you are really running out of space for the data -- you know your files are only 4K, but ask yourself, how much space does the filesystem allocate for them? Check the free space left when the stick says no more space -- free space indicates lack of inodes. No free space, well, there's always the archiver to fix that too.

share|improve this answer
I have a .tar.gz file of the whole folder and copied that to the flash drive easily, but when extracting I get: tar: info/ Cannot open: No space left on device info/ – Herb Jul 18 '13 at 2:34
OK, now what does the df command report as free space? Lots of free space indicates you ran out of inodes. – ubfan1 Jul 18 '13 at 16:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.