Getting "Errno = 24, Too many open files" while restoring
Error Message Seen:
If during a BRU restore operation you get the error message that says
can't open: errno = 24, Too many open files
Operating Systems (OSs) have a predefined limit that is set by the developer for that OS. Most of the time, the limit is approximately 1,000 files. After all, how often do you open 1,000 files simultaneously? The error message is occurring because this limit has been reached.
After BRU restores the files, indexing services (such as Spotlight on Mac OS X and Beagle on Linux) see the new files and perform an index on those newly restored files. During restore operations that included tens of thousands of files, the indexing process is trying to keep up with the speed of BRU's restore process, however, it is unable to do so. This causes the indexing service to have too many files open at one time and thus prevents BRU from properly completing the restore process.
The simplest thing to do to fix this problem is to simply disable your indexing service for the duration of the restore process or in the event of restoring to a separate drive, simply turning off the indexing service for that drive.
$ sudo mdutil -i off /Volumes/DriveName
You will need to replace the "DriveName" with the actual name of the drive in which you are performing the restore operation.
$ sudo mdutil -i on /Volumes/DriveName
Again, you will need to replace the "DriveName" with the actual name of the drive on which you originally disabled Spotlight. Do this after the restore is complete.
To disable Beagle, just modify the crontab entry or move it from /etc/cron.daily for the duration of the restore operation.
To enable Beagle, after it has been disabled, simply revert the crontab entry to it's original value or move it back into /etc/cron.daily after the restore operation is complete.
Alternatively, you can tell the Linux operating system to allow a higher number of open files at once. Do do this, just perform the following steps.
# /usr/local/bru-server/agent --kill
# ulimit -n 20480
If you are running Ubuntu Linux or if you have not enabled the Root account on Mac OS X, you will need to assign a password to the Root user before you can login as Root. To assign a password for Root, run:
$ sudo passwd root
If after making these changes you are still running into the error, try setting a higher limit in step 3 above or completely disabling the indexing service all together if you only stopped it for a drive.