I recently upgraded from Mint 12 to Ubuntu 12.10 + Cinnamon. I have an external usb drive that when I plug it in, automatically mounts to /media/[username]/Backup/. Thing is, under Mint, it didn't include the [username] portion. It just mounted to /media/Backup. My question is, how do I switch back to that format? I don't need the drive mounted under my username. Just under media.

Thanks in advance.

  • This is not the problem of Ubuntu over Mint as such, but is a new feature introduced in the latest linux kernel itself. All external drives are mounted under /media/[username] so even if you try the latest linux mint [mint14], you would face the same situation. As for the solution, wait for others to respond – Sagar_R Nov 8 '12 at 16:46
  • @Sagar_R ahh.. That makes me feel bad. :( – Anwar Nov 8 '12 at 16:47
  • That's good to know. Thanks. I'm hoping there's an easy dconf solution or something, rather than having to manually put something in the fstab. – warkior Nov 8 '12 at 16:59
  • I would like a solution editing only the fstab file. I don't like mounts to use my user name, let alone a misleading "backup" word. – Robert Vila Nov 8 '12 at 22:44
up vote 18 down vote accepted

It's not the kernel but udisks2 where the automount location is hardcoded. You can't configure it.

The original udisks2 uses /run/media/username but Ubuntu patched it to use /media/username/.

I guess Mint 12 like Ubuntu 12.04 comes with udisks1 which uses just /media/.

If you really need the automount disks to be mounted in /media/ you could try to replace /media/your_username with a symlink pointing to /media:

sudo rmdir /media/your_username
sudo ln -s /media /media/your_username
  • Interesting. Ok. I guess I'll just have to live with it then. (and update my backup script paths) Hopefully some day it'll get more configurable. Thanks for the quick answer though. – warkior Nov 8 '12 at 17:13

In Ubuntu 13.04 you can tell udisks2 to automount in /media/ instead of /media/[username]/ by adding a udev rule that sets the environment var UDISKS_FILESYSTEM_SHARED. You can do this by adding a file called (eg) /etc/udev/rules.d/99-udisks2.rules that contains:

ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_FILESYSTEM_SHARED}="1"

I think udev monitors the /etc/udev/rules.d folder to detect changes, but if not, you can force it to reload its rules with sudo udevadm control --reload. Note though that the new mount location doesn't seem to take effect until you physically remove and plug the external drive back in.

This doesn't work in Ubuntu 12.10 because it uses udisks version 2.0.0, and support for the above didn't appear until version 2.0.91.


For your convenience, you can paste the following into the terminal

echo 'ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_FILESYSTEM_SHARED}="1"' | \
sudo tee -a /etc/udev/rules.d/99-udisks2.rules

Now anyone accessing your machine can access the removable disks you plug into it. So be careful. Tested on 14.04, but as pointed out above, it should work on 13.04 and later.

  • how do you find your `udisks`` version? I'm on 12.04 with LTS-Raring HWE and kernel 3.8. – MountainX Sep 24 '13 at 20:49
  • 1
    you can do a : dpkg -l udisks2 And by the way, spot on. The udev rule works like a charm (ubuntu 14.04) – Dolanor Aug 21 '14 at 21:52
  • 1
    Works beautifully on 14.04. – user334639 Feb 10 '15 at 20:00
  • works on 18.04 beaver – Lee May 6 at 5:37

Instead of doing :

sudo rmdir /media/your_username
sudo ln -s /media /media/your_username

You can just do the following, if for example you have a mount point /media/username/DISK_A :

ln -s /media/username/DISK_A /media/DISK_A

like this all your previous configured softwares can continue to access to your files.

  • would that not break when DISK_A is a removable disk? – MountainX Sep 24 '13 at 20:54

You can remove media directory, create a soft link by name media under / which points to your desirable location. Make sure nothing is mounted under media when you do this. Plug your pen-drive and it gets mounted under your desired path. Worked for me.

For anyone who is having this problem with a USB-based Banshee media collection and who does not wish to implement the workarounds above, it's easy to modify the Banshee database directly for the new username/USB location.

  1. Close Banshee

  2. Back up your banshee.db

    cp ~/.config/banshee/banshee.db ~/.config/banshee/banshee.db.bak 
    
  3. Run this SQLite3 query to change the OLD path to the NEW path.

    sqlite3 ~/.config/banshee/banshee.db 'update coretracks set uri = replace(uri, "file:///media/USB%20drive/folder/", "file:///media/[yourusername]/USB%20drive/folder/") where uri is not NULL;'
    

Note: %20 for spaces, use 3 slashes in file:///, and use a trailing /.

source: https://mail.gnome.org/archives/banshee-list/2014-January/msg00019.html

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.