16

Previously, I prevented auto-mounting of a particular partition at boot by the following line in /etc/fstab

UUID=<alphanumeric> /media/windowsHDD ntfs user,noauto 0 0

At some point in the last year, this failed, and the partition was automatically mounted on boot. I attempted the following, which also failed.

/dev/sda1 /media/windowsHDD ntfs user,noauto 0 0

Thinking that perhaps I was bitten by this bug, I removed user, but that also failed.

UUID=<alphanumeric> /media/windowsHDD ntfs noauto 0 0

Is there a way to prevent auto-mounting in fstab?

4
  • 1
    @Jobin I'll try commenting out the entire line. Oddly enough, another noauto entry in there still works /dev/sdb1 /media/3030-3030/ vfat user,noauto 0 0.
    – Sparhawk
    Commented Feb 16, 2014 at 10:30
  • In the bug report that you mentioned yourself, people suggest to use another mountpoint than one inside /media. This folder may get treated in a special way by Ubuntu, and some automount mechanism may mount it even though your /etc/fstab says otherwise. Suggestion: move the mountpoint to somewhere else (/mnt/windowsHDD or whatever) and try again. Don't forget to create the directory that you specify as mount point. Commented Feb 16, 2014 at 12:00
  • @MalteSkoruppa I tried changing the mountpoint to /mnt/windowsHDD. I forgot to create the directory (and I don't want it to automount anyway), but upon restart it was created and mounted there.
    – Sparhawk
    Commented Feb 18, 2014 at 5:55
  • @Jobin commenting out the entire line results in automatic mounting at /media/sparhawk/windowsHDD. Oddly enough, when I do specify the location to mount in fstab, the files are marked green with ls -l. However, when I comment everything out, they are just a normal colour.
    – Sparhawk
    Commented Feb 18, 2014 at 5:57

2 Answers 2

10

In order to avoid this issue make sure of 2 things:

  1. The partition is not mounted in /media
  2. The the name of the target mount directory is different than the partition label value

Check entry in /etc/fstab:

user@raspberrypi:/ $ cat /etc/fstab
/dev/sda1     /media/st1       ntfs-3g noauto,rw         0       0

Check the label of the partition:

user@raspberrypi:/ $ sudo ntfslabel -f /dev/sda1 
st1

Since the name of target mount directory (/media/st1) equals the partition label (st1), the partition will continue to mount automatically despite the noauto parameter in /etc/fstab.


Let's do something to avoid the automatic mount. Create a new directory in /mnt:

user@raspberrypi:/ $ sudo mkdir /mnt/testdir

Edit the /etc/fstab entry:

/dev/sda1     /mnt/testdir       ntfs-3g auto,rw         0       0

Finally change the label of the partition and reboot:

user@raspberrypi:/ $ sudo ntfslabel /dev/sda1 "new_label"

user@raspberrypi:/ $ sudo reboot

The partition shouldn't be mounted automatically anymore.

3
  • 1
    Unfortunately I moved to Arch Linux a few years ago, so I can't really comment on whether this works or not. This problem went away with the migration and/or a KDE Plasma update. However, welcome to StackExchange and thank you for posting this answer. Hopefully it will be useful to others! (P.S. have an upvote.)
    – Sparhawk
    Commented Sep 25, 2017 at 1:09
  • 2
    "Since the name of target mount directory (/media/st1) equals the partition label (st1), the partition will continue to mount automatically despite the noauto parameter in /etc/fstab." .... but why? It's been a long time since I've used labels, but this seems silly when it's explicitly set to noauto.
    – Angelo
    Commented May 2, 2019 at 13:36
  • 1
    did you mean to mount /mnt/testdir with auto and not noauto? Commented Dec 5, 2021 at 10:47
-3

Try addind this to /etc/fstab. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

/dev/sdaX /media/external-noauto ext4 user,noauto 0 0

Or you can use PySDM

Make sure you replace X with your device ID.

7
  • Instead of noauto, what if the line is commented?
    – jobin
    Commented Feb 16, 2014 at 10:18
  • 1
    @Mitch Are you saying to add that line to fstab? Your second and third sentences suggest to run it as a command. Also, it seems like it's essentially identical to my original line, except it's ext4 when my disk is really ntfs. I want to be able to mount it at the listed location if needed, just not automatically.
    – Sparhawk
    Commented Feb 16, 2014 at 10:22
  • @Jobin I'll reply in the main comments below my question.
    – Sparhawk
    Commented Feb 16, 2014 at 10:29
  • Add to fstab, will disable auto mounting. It's slightly different than your original, where you have to add noauto after the drives name. /dev/sdaX /media/external-noauto ntfs user,noauto 0 0 Let me know.
    – Mitch
    Commented Feb 16, 2014 at 10:38
  • That didn't work either. Upon restart, the partition automatically mounted at /media/external-noauto instead.
    – Sparhawk
    Commented Feb 18, 2014 at 5:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .