Every system I know of that stores large numbers of big files stores them externally to the database. You store all of the queryable data for the file (title, artist, length, etc) in the database, along with a partial path to the file. When it’s time to retrieve the file, you extract the file’s path, prepend some file root (or URL) to it, and return that.
So, you’d have a “location” column, with a partial path in it, like “a/b/c/1000”, which you then map to:
Make sure that you have an easy way to point the media database at a different server/directory, in case you need that for data recovery. Also, you might need a routine that re-syncs the database with the contents of the file archive.
Also, if you’re going to have thousands of media files, don’t store them all in one giant directory – that’s a performance bottleneck on some file systems. Instead,break them up into multiple balanced sub-trees.