vertikall
Posts: 5
Joined: Sat May 20, 2017 8:15 am

mount external HDD to mnt instead of media

Sat May 20, 2017 8:21 am

hi,

As the title says I want to mount my external NTFS drive to mnt instead of being automatically mounted to media at boot.
I'm currently having to run

Code: Select all

sudo umount /dev/sda1
sudo mount /dev/sda1 /mnt/HDD
every time I reboot and it's kind of becoming a pain to do this every time.

Overload86
Posts: 7
Joined: Fri May 19, 2017 5:32 pm

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 1:17 pm

Have you had a look at fstab?

https://help.ubuntu.com/community/MoveMountpointHowto

Or autofs?

https://access.redhat.com/documentation ... utofs.html

I'm not sure which one Raspbian uses, but I would guess fstab.

Edit: https://www.modmypi.com/blog/how-to-mou ... pi-raspian

This should help.

Martin Frezman
Posts: 1009
Joined: Mon Oct 31, 2016 10:05 am

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 1:22 pm

Both of which are old (as in 80's, 90's vintage) and bad advice.

fstab is bad because it can cause the booting process to hang if the drive is not present (which is going to be most of the time).

autofs (in its various forms and guises) is precisely what we're trying to get away from.

I agree with OP that this a good goal to pursue, but I am curious as to his exact reason for wanting to do it. The operative question is: Why isn't letting it mount automatically desirable behavior in OP's use case?
If this post appears in the wrong forums category, my apologies.

Overload86
Posts: 7
Joined: Fri May 19, 2017 5:32 pm

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 1:46 pm

Haha the late 90s were actually the last time I was using a linux system on my PC. xD

Just started tinkering with a Raspberry Pi a few days ago and googled his problem.

I am curious however, what is responsible for mounting all the right partitions and automounting external drives now if not fstab?
Knowing linux I would bet a small fortune, that you are able to change this default behaviour somewhere xD

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 1:56 pm

fstab will not cause a hang if the drive is not present. Use the nofail parameter.

Martin Frezman
Posts: 1009
Joined: Mon Oct 31, 2016 10:05 am

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 2:20 pm

SurferTim wrote:fstab will not cause a hang if the drive is not present, provided you happen to know about and know how to use the nofail parameter.
Fixed it for ya.

The point is that most newusers won't know about it (and quite a few oldusers, such as YHN) - and will, naturally, observe that using fstab causes their systems to hang.
If this post appears in the wrong forums category, my apologies.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 4:35 pm

Let me fix it for ya now that I am not on my iPhone. For my ntfs drive.

Code: Select all

/dev/sda1 /media/pi ntfs-3g auto,nofail,rw,default 0 0
or this

Code: Select all

UUID=1D1798506089E3C4  /media/pi ntfs-3g auto,nofail,rw,default 0 0

Martin Frezman
Posts: 1009
Joined: Mon Oct 31, 2016 10:05 am

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 4:43 pm

Yes, you can kludge around the problems, but it is still a bad idea to do this in fstab. Trust me, I've been there, I know.
If this post appears in the wrong forums category, my apologies.

User avatar
rpdom
Posts: 17275
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: mount external HDD to mnt instead of media

Sat May 20, 2017 5:12 pm

Martin Frezman wrote:Yes, you can kludge around the problems, but it is still a bad idea to do this in fstab. Trust me, I've been there, I know.
Why? It works. It has worked for years. Trust me. I've been there yada yada blah.

vertikall
Posts: 5
Joined: Sat May 20, 2017 8:15 am

Re: mount external HDD to mnt instead of media

Sun May 21, 2017 5:24 am

I tried fstab with the nofail parameter and adding rootdelay=10 to /boot/cmdline.txt since the Pi seems to boot faster than it could recognize the drive.

the fstab line I added:

Code: Select all

UUID=<2EA265F5A265C247> /media/HDD ntfs nofail,rw,auto,users,exec,nls=utf8,umask=003,gid=46,uid=1000    0   0
will try to make it into something like this as posted above and post the result..

Code: Select all

UUID=1D1798506089E3C4  /media/pi ntfs-3g auto,nofail,rw,default 0 0
edit: ( just like a homer simpson d'oh moment I did realize that i left in < > in my previous attempt) just did

Code: Select all

UUID=2EA265F5A265C247  /mnt/HDD ntfs-3g auto,nofail,rw,default 0 0
still no dice. still mounts to /media/pi

if it helps I'm using this pi as a p2p seedbox using transmission.

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: mount external HDD to mnt instead of media

Sun May 21, 2017 7:15 am

If /mnt/HDD exists then this should work:

Code: Select all

UUID=2EA265F5A265C247  /mnt/HDD ntfs nofail,defaults 0 0
The road to insanity is paved with static ip addresses

vertikall
Posts: 5
Joined: Sat May 20, 2017 8:15 am

Re: mount external HDD to mnt instead of media

Sun May 21, 2017 9:06 am

Ernst wrote:If /mnt/HDD exists then this should work:

Code: Select all

UUID=2EA265F5A265C247  /mnt/HDD ntfs nofail,defaults 0 0
thanks this worked, also made my root delay to 15 - seems like my external drive is a little bit slow on the get-go.

Return to “Troubleshooting”