Distributed File System
cperciva: I'm not sure I understand what the problem is.  You say that you've got approximately 40000 files; a database which keeps track of where those files are stored is a trivially small problem.