User avatar
begood2
Posts: 25
Joined: Tue Oct 28, 2014 2:15 pm
Location: Utah, USA

USB Name Changes Upon Boot

Tue Oct 28, 2014 2:45 pm

So, here is what I've been doing:

I have a model B+ running raspbian-wheezy (latest image from 09-2014). I have 2 playstation eye cameras plugged into 2 usb ports on the board. I'm using the cameras with the program "Motion" and it works great as a DIY home surveillance system. I haven't had any problems with that program. (Also I'm only recording jpeg files at 5 fps and NOT recording video for both cameras).

The issue I'm having is that I'm trying to save all the captured images to a 16 GB usb plugged into my RPi. I'm leaving on my honeymoon in less than 2 weeks and so short term storage to this usb is fine with me. The purpose of using this right now is to monitor our apartment while we're gone. I'm not saving somewhere on the network because the internet connection sometimes cuts out randomly and isn't dependable long term.

Because I have 2 cameras, I have to use 2 different files that motion references. They are "thread1.conf" and "thread2.conf" located in the directory /etc/motion/

Inside of those files is where I specify where it is I want to save the captured images. My usb is named "camerafiles" currently, so in each thread.conf I tell it to save to /media/camerafiles/

When I run motion everything works great. The only issue is that SOMETIMES my usb mounts itself as "camerafiles" and sometimes it mounts as "camerafiles_" (yes there is a "_" at the very end of the file name). What this means is that sometimes I find my captured images in the correct directory on the usb and sometimes they're in /media/camerafiles_ on the microSD card.

What can I do to permanently mount my usb device as "camerafiles" so that it never changes? I honestly do not want to save all my images onto my microSD card because it's only 4 GB large. I've tried multiple usb devices and the behavior is the same unfortunately.

Any ideas? Thank you kindly in advance! :D

User avatar
begood2
Posts: 25
Joined: Tue Oct 28, 2014 2:15 pm
Location: Utah, USA

Solution!

Fri Oct 31, 2014 12:16 am

So I've found a solution to my question and I thought I would post it here to maybe help somebody else who comes across this problem.

I accidentally found this fix but it seems to be working great! :D

By default the current configuration on the Pi automatically mounts USB drives on ‘/media’ with a unique name and with limited permissions. With a software I found called "USBmount" (which I claim no credit for) I've found a way to assign a "permanent" name to my usb device(s) plugged into my RPi. "The USBmount Debian package automatically mounts USB mass storage devices (typically USB pens) when they are plugged in, and unmounts them when they are removed. The mountpoints (/media/usb[0-7] by default), filesystem types to consider, and mount options are configurable. When multiple devices are plugged in, the first available mountpoint is automatically selected." (http://usbmount.alioth.debian.org/)

To install this software open up the lxterminal (assuming you're using the debian-wheezy raspbian OS) and type:

sudo apt-get install usbmount

No further configuration is necessary and everything is then ready to go. I found that once I inserted my usb, it mounts automatically as /media/usb. **The "new usb device mounted" dialog box does NOT come up by default so you just need to navigate to /media to see where your usb is being mounted to.**

And that's it! Please offer help to the developers to this software if you're interested: https://alioth.debian.org/projects/usbmount/.

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: USB Name Changes Upon Boot

Thu Aug 30, 2018 1:02 pm

Outstanding find! I had this exact problem, once in a blue moon my service would start before the usb device was mounted and wrote everything to a 'virtual location' which seems to be a null bit bucket hence not stored. The application had no exceptions or faults reported by the OS so just carried on as normal. I eventually replicated the issue and saw "/media/pi/DISK" and "/media/pi/DISK1" where DISK1 was the new location that correctly mapped to the flash drive and DISK was the "virtual location" of eternal nothingness.

TL;DR this solved my problem and I thank you for sharing it!!

Dan

k-pi
Posts: 930
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: USB Name Changes Upon Boot

Thu Aug 30, 2018 3:29 pm

If you use a UUID in your /etc/fstab it will always mount at the assigned mount point.

Return to “Troubleshooting”