optional automount of external hdd

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
thoros

optional automount of external hdd

Post by thoros »

Hello,

first of all I´m pretty new to Linux (who would have guessed) and the reason why I am posting here is that I have a problem, which may seem pretty trivial at first glance,
but isn´t as trivial as I hoped it would be (at least not for me). Despite all searching and trying for quite a while now, I have come to a point of resignation and hope to find
some help here.

The circumstances:
I am using a LM 13 xfce x86 machine as a media-pc in my living room (mainly for XBMC). The media I watch is stored on an external NTFS usb drive. I sometimes disconnect the drive from the mediapc
and copy new media to it from another (windows) pc.

Now my problems:
When I attach the drive to the mediapc the system detects the drive (and displays a transparent icon of the drive on the desktop) but it isn´t really mounted (and accessible by XBMC) until I click the icon of the drive on the desktop (the icon changes from transparent to untransparent). That means I have to browse the drive once before I can use it. That alone wouldn´t be a problem as xfce provides an option which is called "browse removable media when inserted" - which has the same effect as if I click the drive manually to browse it after plugging the drive to the mediapc).
The problem is that most of the time the drive is already connected to the mediapc when I turn it on, and of course the above mentioned option doesn´t help me in that case. So in that cases I always have to browse the drive at first and then can use XBMC.
I tried automounting the drive via fstab, but in case the drive is NOT connected at startup, the system requests an user interaction (there is no keyboard connected to my mediapc) and doesn´t boot.
But even if that would work (let´s assume the fstab entry would be ignored if the drive isn´t attached at startup) I would have another problem, because in order to use fstab I was forced to create the mountpoint permanently (in my case /media/Elements as "Elements" is the label of the drive) which causes the "automatic-mount-option when plugged in while running" of xfce to throw an error, because it wants to create this dircetory, but it already exists.
So what I want is this : I want a mount-point ("/media/Elements" - my XBMC is pointed there). When my drive is attached it should exist, and when it´s not it shouldn´t exist - no matter if I attach the drive to the running system (without having to browse the drive once) or if it is attached before booting up. Just like it is in windows when I assign a drive letter to my external drive. Windows always assigns this letter to my drive no matter if i plug it in while windows runs or before boot and I don´t have to browse the drive once before I can access it from within other applications.

I just cannot believe that this shouldn´t be possible as it sounds like a trivial practical case, but I just couldn´t find a way to solve this.
Help please ;)

Greetings
thoros
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
viking777

Re: optional automount of external hdd

Post by viking777 »

Well although I hate automounting and never use it, I can think up this possible workround.

Firstly make your fstab mount point /mnt/Elements not /media/Elements (you will have to create the folder in /mnt) then include the fstab option - nobootwait. Just put a comma after any existing fstab entries and type that word.

The only problem now is that you will have to somehow instruct your media player that it has to look in two different locations for its media. If that is possible then I think it should work otherwise it wont.
thoros

Re: optional automount of external hdd

Post by thoros »

Thank you for your workaround proposal.
The idea is good but when I add both mount-points to XBMC it would list my media-files twice in the library, so that solution isn´t practicable for me.
I must confess I´m a little disappointed that I stumble over so many little problems on my excursion to the Linux world that I have come to the conclusion
that Linux still isn´t mature enough to be used as home-OS. I just don´t have the time and will to deal with so many little issues that simply don´t work
or are unnecessarily complicated (eg try having an application autostarting after booting up, but MINIMIZED [it is possible but soooo complicated]).
Maybe we´ll see again in let´s say 10 years.
Locked

Return to “Storage”