Typically, all media files housed on your external storage are scanned upon boot. The service that does that is called Media Scanner, which saves its output in Media Store. Android's developers have tried hard to optimize it, but Media Scanner is still a service that drains battery quite effectively for the first few minutes following a reboot.

The Media Scanner service itself doesn't offer a preferences menu, and it runs in background so you can't control it. Well, you can't do so easily without the Xposed Framework. XDA Forum Member thomashofmann decided to address the issues with Media Scanner by creating a module that provides quite a few tweaks. With this module, you can easily select which folders will be scanned, run the process in the foreground, or trigger the scan wherever you want it to run. There are even more features, which can be accessed by launching the module icon in the application drawer.

To use this module, your device must be rooted and run Android 4.0.4 or higher. Xposed Framework doesn't yet work with ART, so this and other modules are obviously unusable with the newest release of our favorite operating system, Android 5.0 Lollipop.

You can learn more about the Media Scanner and its behavior by visiting the Xposed Media Scanner Optimizer forum thread. Of course, the module can be found there as well.