# /media subdirectories deleted after reboot

## Timmer

I noticed the other day that my directories in /media are deleted every time I shutdown my computer.  So whenever I try to mount a CD, it fails, because the /media/cdrom directory referenced in my fstab is gone.  If I create it, I can mount without problems.  But then the next time I reboot, it's gone again.

I'm guessing this is a side effect of switching to systemd as my init system, because I can't really think of another cause, but I have no other evidence to back up that theory, so it might be off base.

Additionally (and possibly related), it used to be that devices that were plugged into my computer (USB sticks, for instance) automatically created directories for themselves in /media when I mounted them through KDE.  That no longer happens.

Has anyone had a similar experience?  Is there a service I'm forgetting to start perhaps?  Google hasn't been my friend tonight.

----------

## eccerr0r

For Gnome/Udev /media is a dynamic directory and you should not use /etc/fstab to point to it.  I suspect KDE should be similar.  Make another directory/directories for static mounts through fstab.

I have to admit when Gnome doesn't automount it was a PITA to debug.  I had a problem with Consolekit/Policykit that caused automount to fail.

----------

## Timmer

Hmm.  That's new, or at least different than a year ago.  Good to know though.

----------

## eccerr0r

BTW, for Gnome, if there is a fstab entry for a disk, it will not automount it.  Also not sure if that's also part of the issue?

----------

## SamuliSuominen

/media is obsolete thesedays and /run/media/$user is used instead, see this thread:

https://forums.gentoo.org/viewtopic-t-923640-highlight-udisks2.html

up-to-date -> USE="udisks udev" for gnome-base/gvfs -> /run/media/$user

deprecated -> USE="gdu udev" for gnome-base/gvfs -> /media

and /run is mounted as tmpfs, which will get wiped on each boot

/mnt is supposed to be used for static mounts, from fstab

but this is only affecting users of GNOME and Xfce mostly now, since others are still using SLOT="0" of sys-fs/udisks. The new one is SLOT="2" of sys-fs/udisks.

----------

## mbar

 *ssuominen wrote:*   

> /media is obsolete thesedays and /run/media/$user is used instead, see this thread:
> 
> 

 

Yeah, I was bitten by this also yesterday, this is most unfortunate for mc users...

----------

## SamuliSuominen

 *mbar wrote:*   

>  *ssuominen wrote:*   /media is obsolete thesedays and /run/media/$user is used instead, see this thread:
> 
>  
> 
> Yeah, I was bitten by this also yesterday, this is most unfortunate for mc users...

 

Could you please elaborate? 

I used to maintain MC for a while and can't remember it doing anything special with /media, but that's couple of years ago.

My point is... Maybe I can improve the situation for MC if you tell me the problem.

----------

## mbar

This is an efficiency problem: descending to /run/media/$USER/$MOUNT_POINT takes longer than to /media/$MOUNT_POINT in midnight commander.

----------

## SamuliSuominen

 *mbar wrote:*   

> This is an efficiency problem: descending to /run/media/$USER/$MOUNT_POINT takes longer than to /media/$MOUNT_POINT in midnight commander.

 

You can create a symlink.  It doesn't matter it's dangling (broken) every once in a while. 

For example,

```

$ ln -s /run/media/username /home/username/media

$ cd ~/media

```

----------

## mbar

ok, thanks.

----------

