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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-30-2020, 09:28 PM
|
#1
|
LQ Newbie
Registered: Dec 2020
Posts: 3
Rep: 
|
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
|
|
|
01-04-2021, 09:42 AM
|
#2
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,543
|
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.
|
|
|
01-05-2021, 03:52 AM
|
#3
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
Shouldn't Ubuntu with its default desktop environment provide automount functionality anyhow?
|
|
|
01-05-2021, 09:01 AM
|
#4
|
Moderator
Registered: Aug 2002
Posts: 26,757
|
The built in card reader is not a USB device which is why it has a /dev/mmcblk0p1 device ID versus /dev/usbdisks/sdxy.
|
|
|
01-05-2021, 12:02 PM
|
#5
|
LQ Newbie
Registered: Dec 2020
Posts: 3
Original Poster
Rep: 
|
Quote:
Originally Posted by michaelk
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!
|
|
|
01-05-2021, 12:44 PM
|
#6
|
Senior Member
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: KDE Neon
Posts: 1,271
|
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.
|
01-05-2021, 04:37 PM
|
#7
|
Moderator
Registered: Aug 2002
Posts: 26,757
|
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.
|
01-06-2021, 05:30 AM
|
#8
|
LQ Newbie
Registered: Dec 2020
Posts: 3
Original Poster
Rep: 
|
Quote:
Originally Posted by michaelk
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
|
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!
|
|
|
All times are GMT -5. The time now is 09:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|