Create a usb drive auto-mounting solution that always works

I started using Kodi recently with LibreELEC on a Pi 1 Model B. I quickly switched to OSMC because I can install whatever I need and have greater flexibility.

So I am now running OSMC on the same hardware and with the same USB keys. With LibreELEC they always auto-mounted on boot up and a Samba share was created for them with a name equal to the usb drives label. However under OSMC they almost never auto-mount on boot up. I created a thread about this already and have read extensively about the issue on these support forums.

I know that the OSMC team have planned and discussed for at least five years now switching the auto mounting approach from udisks/udisks-glue to udevil/devmon. I also read bits alluding to issues that still need to be ironed out.

I would love to know exactly what the issue is, what is being done, how close is a solution. Could I help? I don’t want to hear the words… “It’s a power issue” and be told the solution is to buy a powered hub so I can spend more money on something I shouldn’t need to buy that draws more electricity that shouldn’t have to be wasted.

It seems the issue might be that under OSMC usb drives take longer to spin-up at system boot. Maybe they aren’t spinning fast enough when udisks-glue service runs to see are there any drives that need to be mounted? There is a workaround I am using for now, suggested on these forums, in which I added a sleep 10 to the udisks-glue service. Now the same usb keys are always mounted on boot. It adds 4 seconds to the boot up time which I can live with. At the least I think this is the workaround that should be recommended to people instead of buying more hardware un-necessarily.

How come my usb keys plugged into the same Pi 1 are auto-mounted under LibreELEC but not OSMC? Does OSMC draw more power at boot up than LE and this diverts power away from the USB drives so they aren’t spinning fast enough for udisks-glue?

Over at LibreELEC I asked them to explain how they do auto-mounting. They responded with helpful information about how they use udev rules and udevil. Could the OSMC team just implement this approach? Maybe the task is a lot more complicated under OSMC for various reasons. That would be understandable. But really I think it’s time to prioritize a bullet proof auto-mounting solution for OSMC.

I would glady try and set up the LibreELEC approach on my OSMC installation and feedback but I might need some help.

Kind regards,


We looked at udev and udevil a few years ago. It’s not flexible enough for our use case. So we will implement our own solution, but it’s very low priority at the moment as the current solution works well.

If your drive isn’t getting enough power, then software isn’t going to fix that. The auto mounting system is robust at the moment, we just want to update it to support niche file systems better and offer the user more customisation over what, and how, things are mounted.

If you think there is an issue, then please provide logs and details about your hardware setup, including your power supply. My understanding is that you have only ever tested this functionality on a Pi 1 with a known USB issue. This model can not provide enough power for an external hard drive without a USB hub or external power supply. Support for this was added in later revisions of the Pi.

Your post on the LE forums also shows that you have mount issues with udevil, which would indicate hardware issues.

Hi Sam, thanks for responding.

First of all I don’t mean to be rude even if I might be coming across that way. I got a bit wound up about this and it’s important to me to understand what’s going on so your help is very appreciated.

Out of interest why is udev/udevil not flexible enough for OSMC?

About my Pi 1 Model B you say “this model cannot provide enough power for an external hard drive without a USB hub or external power supply” but it can and does when I am running LibreELEC. Why do you think my usb drives mount and get Samba shares when my Pi is running LibreELEC but not when the same Pi is running OSMC?

My set up and logs are in the other thread I made recently. I use a Raspberry Pi 1 Model B, circa 2014. Here is the power supply which I bought about six weeks ago new. Here is the log I posted previously taken after two usb keys were attached and neither mounted. Here is a log when the two usb keys DID auto-mount. But it doesn’t matter if one is attached or more… 9 times out of 10 it/they don’t auto-mount.

I don’t think I would say the Pi I use has a usb issue? As you pointed out previously the Pi Model 1 B usb drive is not hot plug-able. It actually reboots when you put a usb key into it or take it out… it’s inconvenient but would that stop osmc from auto-mounting a usb key on it?

As to my post on the LibreELEC forum about my mount issues with udevil on osmc. Yes, I tried to install udevil on OSMC. But I didn’t configure it properly at all, I didn’t use any udev rule, which I now understand a bit more thanks to their response explaining how their udev rule calls udevil to do the mount. I suspect that is why it wasn’t working properly although I could be wrong.

Also I couldn’t figure out how to really disable/mask udisks and udisks-glue. systemctl disable udisks doesn’t seem to work because other services seem to depend on it so they start udisks when they start at next reboot. I tried masking the udisks service but then when I went to reverse that I couldn’t get udisks to start again so I re-installed it but I think I installed the wrong version, I think there’s a osmc-udisks? After that I ended up just doing a fresh install of OSMC and made a backup this time!

Call me crazy but I would like to try the LibreELEC approach on OSMC. Can you help me? I have made a backup now so can try anything and go back. What is the best way to totally stop the functioning of udisks/udisks-glue? I tried systemctl disable and that isn’t reliable. I can try some or all the combinations from this thread. Other than that do you think it reasonable to try set up the LibreELEC approach exactly as they have described it? Would I need to do anything differently for osmc?

Thank you,


No offense taken.

OSMC is widely used, and I think that if automounting didn’t work well, we’d get a lot of complaints. Out of curiosity, I set up a boot loop on a Vero 4K + with a powered USB hub and ran 100 reboots, checking on each reboot automatically that disks were mounted under /media. This succeeded for each boot.

This has been covered in more detail in other posts. It doesn’t support post-mount commands or handling of FUSE based filesystems very well. But that aside, I don’t think it will resolve your issue.

OSMC uses more power than LibreELEC for performance reasons during bootup (perf gov during 60s boot with dropdown to ondemand)

I think you’re missing a crucial point here.
The model of Raspberry Pi you have cannot output more than 500ma per USB port. This was only later rectified on the Raspberry Pi Model B+ and later. 500ma is not going to be sufficient for a spinning USB drive.

Initially you said USB key, which implied you were using a USB thumb drive. This would work. But as you’ve referred to the drive as having a 2TB capacity, this is almost certainly a mechanical hard drive.

Powering such a drive (if it’s 2.5") is borderline and can lead to serious corruption and problems in the long term.

The power surge is indicative of an issue.

That’s not correct. Just make sure you disable udisks and udisks-glue.

I’m not convinced there’s an issue with OSMC’s automounting here.

You are trying to circumvent powering your hard drive correctly and this will likely end in tears in the form of significant data corruption if you do manage to get it working. Using udevil isn’t going to lower your power consumption, and I’m not of the belief that there’s an inherent issue with the way we mount drives.

You are welcome to try this but it’s not something we intend to support, particularly as we have no intention of ever integrating this method of disk mounting in to OSMC. To assist you with this to try and circumvent power requirements would be doing you a disservice, as well as negligent towards the integrity of your data.

If you desperately want to use udevil and don’t care about your drive, the easiest solution is to use LibreELEC. To me, this feels a lot like the guys that ask how to underclock their Pi so they can use a power supply that is not fit for purpose.


1 Like

Hi Sam,

Thank you for your detailed response which was really helpful and interesting.

By the way, my 2TB drive is actually a USB key/thumb drive that turned out to be a chinese fake. I managed to use f3 to re-partition it to it’s actual usable capacity of 29GB. It still doesn’t auto-mount in OSMC on my Pi 1 Model B.

Anyway, I also have a Pi 3B+ that I can start using instead of the Pi1 Model B. At they say the Pi 3B+ can supply a maximum of 1200mA to downstream USB peripherals. This forum post states there are: "…no per-port limits (which means all 1.2A can come out of a single port if no other USB ports are in use). "

I have searched a lot trying to get detailed numbers of the amperage drawn from the Pi by an attached USB 2.5" self-powered drive when idling, under load and when spinning up. This thread used an in-line usb voltage tester to record amps drawn by a WD Passport Ultra and reported idling (0.22A) and under load (0.42A). I’m not sure about spin-up but a WD support forum thread states: “If using a WD Passport , or WD Elements Portable 2.5” hard drive, please ensure that the computer’s USB ports supply at least 650 milliamps through the USB ports. "

I would like to avoid having too many power supplies if I could. Do you think those numbers above suggest it could be reasonable to have OSMC on a Pi 3B+ with a single attached 2.5" self-powered external usb drive to store all media? I’m thinking of getting a Western Digital 4 TB My Passport Portable USB drive and plug it directly into the Pi 3B+. Would this set-up really be a borderline case, with potential to cause data loss, as you described above?

If you still don’t think it’s worth the risk then would you happen to know of any Powered USB hubs that can also power a Pi so only one power supply/plug/outlet is needed? Maybe the D-Link DUB-H7/B 7-Port USB 2.0 Hub can power a Pi and its peripherals? The manufacturer of the Plugable USB 2.0 7-Port Hub claim that it can: “Power the Raspberry Pi and its attached USB devices”. There is even a project where someone made such a device themselves so I guess it can be done. What do you think about all this?



Hi Flex,

I was going to say: if you did actually have a 2TB flash drive, I don’t think you’d think twice about upgrading your Pi given the cost of such a flash drive.

It’s also possible that if the drive is counterfeit, there are other issues with it that are causing your problems.

Possibly. It’s not something I would chance myself.

I don’t have a recommendation for a hub that can also power your Pi. If you find one that can, it will be quite expensive.

1 Like

Thanks for all your advice Sam.