automount sd-card on Beaglebone Black with Ubuntu 16.04 never worked

389 views
Skip to first unread message

michael c

unread,
May 4, 2017, 5:04:15 PM5/4/17
to BeagleBoard
I'm surprised to not see this addressed adequately anywhere, maybe it's unique to me, but i have never seen my BBB (4.4.62-ti-r99) with Ubuntu 16.04 automount my sd-card. it mounts fine on boot when i execute. 
mount -v /dev/mmcblk0p1 /media/sd-card
same FAT cards always work flawlessly on my notebook U16.04.
i'm using eMMC for booting.
and since this is a camera type product a UUID on the sd-card won't work. any card could be plugged, and un-plugged at any time.

im reading about fstab and autofs but don't see a clear path to dynamic plug and play sd-card mounting/unmounting.

thanks, i must be missing something, still looking.

michael

Robert Nelson

unread,
May 5, 2017, 10:47:52 AM5/5/17
to Beagle Board, michael c
"auto-mounting" is normally done by the window gui (gnome/kde/lxqt).

Regards,

--
Robert Nelson
https://rcn-ee.com/

abraxas1

unread,
May 5, 2017, 11:18:08 AM5/5/17
to Robert Nelson, Beagle Board

Right, thanks. Knowing that, I should have remembered to mention it's on a headless embedded system. Personal camera type, where the card can be ripped in and out as people tend to do...
Right now I search for a device with a uuid looking like xxxx-xxxx, and then I can mount that I guess.
There can never be any other device getting connected.
But still concerned about detecting it's removal before a failure reveals it.
Set up a periodic polling function to check on its existence?
Thanks,
Michael

michael c

unread,
May 5, 2017, 12:48:06 PM5/5/17
to BeagleBoard, robert...@gmail.com
udisks2 to the rescue.
basic usage i suppose.
here's my rule
/etc/udev/rules.d/99-mount-sd-card.rules
SUBSYSTEM=="block", ACTION=="remove", RUN+="/bin/sh -c '/home/scripts/sdunmounted'"
SUBSYSTEM=="block", ACTION=="add", RUN+="/bin/sh -c '/home/scripts/sdmounted'"

/home/scripts/sdmounted
mount -v /dev/mmcblk0p1 /media/sd-card

it is a closed, headless, embedded system. i believe the card should always appear as mmcblk0p1

my software detects a functioning card on boot,
but i guess it will notice it's not there during operation by failing.
or i could send a signal into my c code program that alerts it to it's removal? or insertion?
not sure how that would work without the c code polling something.

Thanks!
ciao,

Robert Nelson

unread,
May 5, 2017, 12:53:28 PM5/5/17
to michael c, BeagleBoard
On Fri, May 5, 2017 at 11:48 AM, michael c <abra...@gmail.com> wrote:
> udisks2 to the rescue.
> basic usage i suppose.
> here's my rule
> /etc/udev/rules.d/99-mount-sd-card.rules
> SUBSYSTEM=="block", ACTION=="remove", RUN+="/bin/sh -c
> '/home/scripts/sdunmounted'"
> SUBSYSTEM=="block", ACTION=="add", RUN+="/bin/sh -c
> '/home/scripts/sdmounted'"
>
> /home/scripts/sdmounted
> mount -v /dev/mmcblk0p1 /media/sd-card
>
> it is a closed, headless, embedded system. i believe the card should always
> appear as mmcblk0p1

Yeah, this fix was back-ported to v4.4.x, so as long as it's v4.4.x+
based system, that will be true..

>
> my software detects a functioning card on boot,
> but i guess it will notice it's not there during operation by failing.
> or i could send a signal into my c code program that alerts it to it's
> removal? or insertion?
> not sure how that would work without the c code polling something.

idk, directly using the hot-swapping sd card is going to be risky..

I think it would be better to have a local cache, and just rsync it to
the card when it get plugged in. Then have some sort of active
sync/mirror operation..

michael c

unread,
May 5, 2017, 1:14:57 PM5/5/17
to BeagleBoard, abra...@gmail.com

>
> my software detects a functioning card on boot,
> but i guess it will notice it's not there during operation by failing.
> or i could send a signal into my c code program that alerts it to it's
> removal? or insertion?
> not sure how that would work without the c code polling something.

idk, directly using the hot-swapping sd card is going to be risky..

I think it would be better to have a local cache, and just rsync it to
the card when it get plugged in.  Then have some sort of active
sync/mirror operation..


yes, very interesting. i'm not at all sure the AM335x has the horse power to be moving these files around in a convenient time scale though. 
converting raw h264 to mp4 takes some time and ripping out a thumbnail more time.
interesting idea though. also need a lot of cache for potentially large 1080p video files.

ciao,
michael
 

Robert Nelson

unread,
May 5, 2017, 2:49:46 PM5/5/17
to Beagle Board, michael c
On Fri, May 5, 2017 at 12:14 PM, michael c <abra...@gmail.com> wrote:
>>
>> >
>> > my software detects a functioning card on boot,
>> > but i guess it will notice it's not there during operation by failing.
>> > or i could send a signal into my c code program that alerts it to it's
>> > removal? or insertion?
>> > not sure how that would work without the c code polling something.
>>
>> idk, directly using the hot-swapping sd card is going to be risky..
>>
>> I think it would be better to have a local cache, and just rsync it to
>> the card when it get plugged in. Then have some sort of active
>> sync/mirror operation..
>>
>
> yes, very interesting. i'm not at all sure the AM335x has the horse power to
> be moving these files around in a convenient time scale though.

moving between mmc devices will at-least utilize the dma.

> converting raw h264 to mp4 takes some time and ripping out a thumbnail more
> time.
> interesting idea though. also need a lot of cache for potentially large
> 1080p video files.

michael c

unread,
May 5, 2017, 3:13:57 PM5/5/17
to BeagleBoard, abra...@gmail.com
hum, make i can make some tests on that someday. but would need to revisit the ddr on the board, right now the 2gigs we have there is pretty full with video processing.
plus even just one video file can be 8 gigs. 
put it on the list for v2.0

:-)
Reply all
Reply to author
Forward
0 new messages