Picture the scene: Day three of my Vegas vacation, I am a mixture of hungover, jet lagged and suffering from the Vegas culture shock. I’m so spaced out that I’m struggling to work out the tip on my meal.
Then I get the message that Fab users can’t upload photos. I stagger back to the hotel room and feeling like a technical Hunter S. Thompson I fired up ssh to investigate. It turns out that mkdir is failing with the error ‘too many links’ and a Google reveals that there is a limit of 32K directories in a directory which is way less than I thought.
Fortunately it’s not that difficult to resolve, so I write a migration script to move the album directories around so that each parent directory has no more than 10,000 directories within it. There were just a couple of helper functions that are used to display photos so I didn’t need to change that many things to get it working again.