I currently have 600,000 files in a folder, using approximately 875gb of space.

I'm getting the following error message

mv: cannot move `./PMC2836074/zbc4695.pdf' to `/primo_archive/data/updates/PubMed_Central/fulltext/zbc4695.pdf': No space left on device

It was suggested to me that I move the files to folders and that would relieve the problem, because I still have lots of space on the hard drive.

If I create a new folder for every file, will I have the same issue?

  • What is your filesystem? – lgeorget Apr 4 '17 at 13:52
  • 6
    inodes are allocated per filesystem, so creating a folder in the same filesystem won't help. You will have to move then to another drive. – Kusalananda Apr 4 '17 at 13:58
  • df -i will show you if you've run out of inodes. – Ulrich Schwarz Apr 4 '17 at 14:07
  • 1
    Which OS are you running? mount might show you what the filesystem is, and relevant lines from that and df and df -i might be useful to review here. – ilkkachu Apr 4 '17 at 14:12
  • 1
    Please edit the question with the outputs asked in the previous comments: df, df -i, mount – Bruno9779 Apr 4 '17 at 14:42

Moving files to a different directory on the same partition won't help with a space problem. The files woul use the same amount of space if they were in separate directories. (Actually, a little bit more since more directories means more space for the directory metadata, but the difference would be negligible unless the files are tiny.) If the target filesystem is full, it's full.

There is a reason not to have 600,000 files in the same directory, which is performance. Even good filesystems are slow with so many files, and a lot of GUI software might try to enumerate all the files in a directory. You should split the files into sensible subsets (by author, by journal, by date… or by the first few characters of the file name if nothing else makes sense). Aim for 100–1000 files max per directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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