Posts: 19
Joined: Thu May 21, 2020 2:36 pm

/media/user/usbN Issues with automounting and folder naming

Fri Nov 13, 2020 5:48 pm

Hello fellas!

I have not been able to find a solution or anybody else with the same problem. My googling capabilities today have not been very succesful.

Here it goes:

I have set raspberry pi os to automount removable media. I have a usb disk drive that is nearly always plugged in, but not always.

When I insert the usb drive, it gets mounted in /media/user/usbdrive. But, from time to time, something goes wrong and that folder remains and the device gets mounted subsequently in new folders called /media/user/usbdrive1, /media/user/usbdrive2, /media/user/usbdrive3, ....... /media/user/usbdriveN. I suspect this might be due to inappropriate shutdowns, but I am not sure. To solve the problem, I have to delete all those extra folders with the drive unplugged, but it's a bit of a pain.

This specially becomes an issue when trying to automate backups using rsync, because it obviously can't find the correct data when looking in the wrong folder.

Why does this happen and what can be done? This not only happens on raspberry pi os, I have also seen this behaviour on other linux distros.

I would like to avoid editing fstab if possible, as the device is meant to be a portable and removable drive that gets backed up when it's plugged in.

Thank you.

Posts: 4833
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: /media/user/usbN Issues with automounting and folder naming

Sat Nov 14, 2020 6:04 am

even if you abhor doing it... how about mounting it permanently using /etc/fstab

that way it always mounts at the same directory every time.....

even if it is a removable drive....

I've done the same before... and it always mounts at the same directory even after plugging it in later...
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Posts: 19
Joined: Thu May 21, 2020 2:36 pm

Re: /media/user/usbN Issues with automounting and folder naming

Mon Nov 16, 2020 11:19 am

Yes, I will end up having to include it in fstab. But, even being in fstab, on occasions, I still encounter the same problem. I have various raspberries and I have a bunch of disks on my nas raspberry, all of them included in the fstab file, and I have seen this occur there as well from time to time- After a reboot it gets fixed, so something does seem to be going wrong. Maybe the usb connection fails? Bad cable? Dunnow...

Thanks anyhow.

Return to “Beginners”