How to fix sd card mount directory path?

When i insert sd card, it mount to /media/ubuntu/** (Different cards with different names) automatic,how can i fix it at /media/ubuntu/sd_card no matter which card.

1 Like

That’s a general Linux thing, a bit more specifically how Ubuntu does it. I’m not sure of the “proper” way to always mount an SD card in some specific place, but you could probably add the specific mount option in “/etc/fstab”. I don’t know if this is actually what you want, but for example illustration this might work (assumes ext4 formatting…see “man fstab” for customizations):

/dev/mmcblk1p1  /media/ubuntu/sd_card  ext4  defaults  0 0
1 Like

Ubuntu mounts the SD card using the name of the partition as it was formatted.
If your SD card partition has volume named ‘sd_card’ then it should be mounted into the path you want.
However, the solution provided by @linuxdev is probably better.

There are tools such as usbmount which will enable functionality like this. I have though had issues with it on the TX1 causing some drives to never be mounted until I do it manually (usually happens when a drive is removed and re-inserted many times without reboot)

Another solution is to write a simple demon script that you start at boot that checks for /dev/mmcblk1p1 and mounts it to a location of your choosing.

It is an interesting problem when auto-mount gets involved. In fstab if you use options “defaults”, then it’ll be expected that the device is always there; using “noauto” (e.g., “noauto,user,exec,owner,exec”) can alleviate the need to always have the device (but once mounted you still have to safely umount or eject the device to stop it…one could mount synchronously and ignore some hazards of sudden removal). Do check out the options in “man fstab”.

So I guess for an fstab answer one would have to be careful to use parameters which only provide a place to mount and not make mount mandatory. Something like usbmount would take care of some of that for you if it works. I never have looked to see what the udev rules are for getting involved with SD card auto-mount, but it might be possible to just use that to change the mount point rule and have auto-mount otherwise go merrily on its way functioning as it always has other than mount point. Anyone here ever investigated how udev is involved in SD card auto-mount?