LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-30-2020, 09:28 PM   #1
jfriordan.kcv@gmail.com
LQ Newbie
 
Registered: Dec 2020
Posts: 3

Rep: Reputation: Disabled
Using autofs to mount /dev/mmcblk01p to /media/autousb


Hello all,

Running Ubuntu 16.04,

I am sure this is an admin error, not the OS. admin being me.

I am trying to automount an internal sd card reader when the sd card is inserted into a laptop. I have already been able to get external SD card readers to automount once the card is inserted, and an Iphone to automount using ifuse. Below are the following commands when the card is inserted:



**fdisk -l**

*/dev/mmcblk0p1 8192 31116287 3110896 14.9g c W95 FAT32 (LBA)*



**blkid**

*/dev/mmcblk0p1: UUID="3434-6531" TYPE="vfat"

/dev/mmcblk0: PTTYPE="dos"*



After card is inserted I run dmesg:



**dmesg**

mmc0: new ultra high speed SDR104 SDHC card at address aaaa

mmcblk0: mmc0:aaaa SC16G 14.8 GiB (ro)

mmcblk0: p1



The Following information is how I am mounting the others that are working, and would love to append to something to get the internal card reader to work, assuming it's possible. Or can I add another auto.foo file and use auto.master to call it?



In the /etc/auto.master file:

+ auto.master

/media/autousb /etc/autofs/auto.usb



In the /etc/autofs/auto.usb file: (that is currently working with the usb and iphone automounts)

key=${1}

fstype=$(/sbin/blkid -o value -s TYPE /dev/usbdisks/${key})

if [ "$fstype}" = "vfat" ]; then

echo "-fstype=vfat,sync,uid=0,gid=1000,umask=007 :/dev/usbdiskss/${key})"

exit 0

else

echo "-fstype=exfat,sync,uid=0,gid=1000,umask=007 :/dev/usbdisks/${key}"

exit 0

fi

exit 1



I am able to mount the device from the command line with the following command once the card is inserted:

**mount -t vfat -o defaults,rw,dmask=007,fmask=117,uid=1000,gid=1000 /dev/mmcblk0p1 /media/autousb**



All I need to do is read the card as I put the contents of the media into another directory, so "read only is not an issue"



My mount point is: **/media/autousb**



Output of /dev after card is inserted with ls -ltr /dev is: **brw-rw---- 1 root disk 179, 0 Date mmcblk0**



and **brw-rw---- 1 root disk 179, 0 Date mmcblk0p1**



Output of /dev/block also shows **179:0 -> ../mmcblk0**



and **179:1 -> mmcblk0p1**



I am sorry if I have not formatted this correctly and I hope I have given enough information for you to be able to make sense of what I am asking. I have tried so many different things after so many google searches and they just don't seem to work.



Thanks in advance, and hope you all are well.

John
 
Old 01-04-2021, 09:42 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,543

Rep: Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608Reputation: 2608
581 views, no replies. Let me try

Your work looks ok. VFAT & FAT are being deprecated. Use another type - ext4 or ntfs if you have to interface with M$.
Put the details in /etc/fstab with the 'user' mount option if you want user mount, or auto if you want it mounted on boot. I won't comment on your automount config - I don't use those toys which are a pain in the face. You're on your own there. They're different on every WM anyhow.
 
Old 01-05-2021, 03:52 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Shouldn't Ubuntu with its default desktop environment provide automount functionality anyhow?
 
Old 01-05-2021, 09:01 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,757

Rep: Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318
The built in card reader is not a USB device which is why it has a /dev/mmcblk0p1 device ID versus /dev/usbdisks/sdxy.
 
Old 01-05-2021, 12:02 PM   #5
jfriordan.kcv@gmail.com
LQ Newbie
 
Registered: Dec 2020
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
The built in card reader is not a USB device which is why it has a /dev/mmcblk0p1 device ID versus /dev/usbdisks/sdxy.
Thank You,
Yes understood it's not a USB device. I have tried to add to my auto.master and point to a file I created called /etc/autofs/auto.mmc that I thought would mount /dev/mmcblk0p1 to /media/autousb. I am just using /media/autousb as a holding space for the files as I move them to a working directory. I'm just not doing it correctly I assume. I have read so many different articles I just can't seem to get it.

Thanks again!
 
Old 01-05-2021, 12:44 PM   #6
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: KDE Neon
Posts: 1,271

Rep: Reputation: 525Reputation: 525Reputation: 525Reputation: 525Reputation: 525Reputation: 525
Have you considered using a udev rule instead of autofs?
Here is a link to making a udev script to mount an SD card to a specified location:
https://www.programmersought.com/article/20242483180/
 
1 members found this post helpful.
Old 01-05-2021, 04:37 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,757

Rep: Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318
Code:
auto.master
/media/autousb /etc/autofs/auto.mmc

auto.mmc
mmc -fstype=auto,sync,uid=0,gid=1000,umask=007 :/dev/mmcblk0p1
And this should mount the sdcard at /media/autousb/mmc
 
1 members found this post helpful.
Old 01-06-2021, 05:30 AM   #8
jfriordan.kcv@gmail.com
LQ Newbie
 
Registered: Dec 2020
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by michaelk View Post
The built in card reader is not a USB device which is why it has a /dev/mmcblk0p1 device ID versus /dev/usbdisks/sdxy.
Quote:
Originally Posted by uteck View Post
Have you considered using a udev rule instead of autofs?
Here is a link to making a udev script to mount an SD card to a specified location:
https://www.programmersought.com/article/20242483180/
Thank you all for taking the time to respond to my question. Using udev to mount the card once inserted did the trick. I really appreciate it.

Be well everyone!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] autofs passing username to autofs mounts Timothy Miller Linux - General 3 08-27-2018 06:24 PM
[SOLVED] any autofs experts here? how to get autofs and WebDAV to play nice? zippydan Linux - General 2 09-05-2016 07:13 PM
[SOLVED] autofs does't mount /dev/sdaX newbie0101 Linux - Software 2 01-22-2012 04:53 PM
pseudo terminals: /dev/ptmx <-> /dev/pts/ vs. /dev/ptyp <-> /dev/ttyp rtspitz Linux - Software 2 12-02-2011 02:07 PM
OpenSUSE x86_64 does not mount /dev/tape (or /dev/st0 or /dev/nst0) yankeeinga Linux - Newbie 6 08-21-2008 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration