How to stop other partitions from auto-mounting [solved]

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

How to stop other partitions from auto-mounting [solved]

Post by beng12 »

Mint 17 Qiana w/xfce.
Suddenly all my other drive partitions are mounting at startup, where they did not before. Don't know why. Not an urgent issue, but I rather like how it was before --
just mounting from desktop when necessary. Here's /etc/fstab:

# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda6 during installation
UUID=048e0813-3eb0-4016-9b37-cb9d3ec43738 / ext4 relatime,errors=remount-ro 0 1
/mintswap.swp none swap sw 0 0

And /etc/mtab:

/dev/sda6 / ext4 rw,relatime,errors=remount-ro 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/cgroup tmpfs rw 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /run/user tmpfs rw,noexec,nosuid,nodev,size=104857600,mode=0755 0 0
none /sys/fs/pstore pstore rw 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,noexec,nosuid,nodev,none,name=systemd 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,user=bee 0 0
/dev/sda2 /media/bee/Windows\0407 fuseblk rw,nosuid,nodev,allow_other,default_permissions,blksize=4096 0 0
/dev/sda5 /media/bee/Share fuseblk rw,nosuid,nodev,allow_other,default_permissions,blksize=512 0 0
/dev/sda3 /media/bee/Linux1 ext4 rw,nosuid,nodev,uhelper=udisks2 0 0

Last 3 on mtab are the now-automounted partitions. TIA.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to stop other partitions from auto-mounting

Post by Flemur »

/dev/sda2 = ntfs (= "fuseblk")
/dev/sda5 = ntfs
/dev/sda3 = ext4

Put a line for each in your /etc/fstab and include the "noauto" param:

Code: Select all

LABEL=LBAK    /mnt/LBAK    ext4   noauto,user   0 0
LABEL=NTFS    /mnt/NTFS    ntfs    noauto,user,windows_names  0 0
(Or use UUID rather than LABEL; you might want different params on the NTFS partitions).

Get the values for LABEL or UUID from

Code: Select all

sudo blkid
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
beng12

Re: How to stop other partitions from auto-mounting

Post by beng12 »

******* Edit: Oops, replied before I saw your response, Flemur. Will try your suggestion, but still confused on why this happened. Before I do, I'll set the disk management settings back to what they were originally.

OK, went to the Disk Management program, clicked on the partitions in question, mount options, switched automatic mount options "on" (it was off) and unchecked "mount at startup". Rebooted and it worked on one partition (Linux1), but not the other two (Windows7 and Share).
beng12

Re: How to stop other partitions from auto-mounting

Post by beng12 »

OK, Flemur, that worked. Thanks. When researching, I came across those commands, but wondered if there was a simpler way, but guess it doesn't matter. Still wondering why that happened, but only a minor mystery. Here's the new fstab entries for info:

# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda6 during installation
UUID=048e0813-3eb0-4016-9b37-cb9d3ec43738 / ext4 relatime,errors=remount-ro 0 1
/mintswap.swp none swap sw 0 0
/dev/sda2 /media/bee/Windows7 ntfs noauto,user 0 0
/dev/sda3 /media/bee/Linux1 ext4 noauto,user 0 0
/dev/sda5 /media/bee/Share ntfs noauto,user 0 0

and mtab with those manually mounted:

/dev/sda5 /media/bee/Share fuseblk rw,noexec,nosuid,nodev,allow_other,blksize=512 0 0
/dev/sda3 /media/bee/Linux1 ext4 rw,noexec,nosuid,nodev 0 0
/dev/sda2 /media/bee/Windows7 fuseblk rw,noexec,nosuid,nodev,allow_other,blksize=4096 0 0
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to stop other partitions from auto-mounting

Post by Flemur »

OK, went to the Disk Management program,
I've never used that - reading in this forum, it seems to do funny things.
and mtab with those manually mounted:
If you use terminal much and want to (un)mount those partitions easily, there's an easy way.

I made commands 'mo' and 'um' in ~/bin.

To mount that LBAK partition I type "mo LBAK" (unmount = "um LBAK").

cat mo

Code: Select all

#!/bin/bash
mount /mnt/$1
cat um

Code: Select all

#!/bin/bash
umount /mnt/$1
Just for consistency I made the LABELs = the mount points: LBAK mounts to /mnt/LBAK, etc.
(LBAK means 'linux backup' = copies of working OS's; I have several other partitions with the same naming convention).

FWIW, the NTFS partition need to be mounted as root (and 'sudo' won't work if the 'mo' and 'um' commands are local):

Code: Select all

$ mo NTFS
Error opening '/dev/sda9': Permission denied
Failed to mount '/dev/sda9': Permission denied
Please check '/dev/sda9' and the ntfs-3g binary permissions,
and the mounting user ID. More explanation is provided at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged
I got the stuff at their link working at one point, but a re-install broke it and I haven't been able to get it working since then.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
beng12

Re: How to stop other partitions from auto-mounting

Post by beng12 »

Thanks again. I'll study your response -- always good to get new ideas.

The Disk management prog does indeed do some funny things, but I've used to make partition images and that is convenient & works fine.

Edit: Ntfs needs to be mounted as root? Just tried editing and saving a text file on mounted Share partition (ntfs), and it saved properly. OK, perhaps that's only
for getting your scripts to work.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to stop other partitions from auto-mounting

Post by Flemur »

Edit: Ntfs needs to be mounted as root? Just tried editing and saving a text file on mounted Share partition (ntfs), and it saved properly.
Just root for mounting. I just mentioned it so you'd know in advance.

After it's mounted anyone can come in a delete everything, so I consider it a bug.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
altair4
Level 20
Level 20
Posts: 11453
Joined: Tue Feb 03, 2009 10:27 am

Re: How to stop other partitions from auto-mounting

Post by altair4 »

This is becoming a very confusing thread.

If you add an entry like this in fstab for a Linux filesystem:
LABEL=LBAK /mnt/LBAK ext4 noauto,user 0 0
The partition will not mount at boot ( noauto ) but an ordinary user ( from the "user" option ) can mount it - not graphically because of the /mnt mount point but - through the terminal.

With an entry like this in fstab for an NTFS partition:
LABEL=NTFS /mnt/NTFS ntfs noauto,user,windows_names 0 0
This partition will also not mount at boot but unlike it's ext4 cousin the "user" ( and "users" ) option has no meaning in NTFS by default so an ordinary user cannot mount the partition. Only root can mount the partition.

Without the unnecessary interference by the "Disks" utility I suspect the way it used to mount - through the file manager - would return to normal and an ordinary user would be able to mount the partition as required.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
beng12

Re: How to stop other partitions from auto-mounting

Post by beng12 »

altair4, trying to understand your response. I realize you're mostly responding to Flemur, but w/the additions to fstab I show above, I'm able to click on a desktop partition (which is unmounted) & the file manager comes up immediately on that partition (mounted) without typing in my password -- just as it did before my "issue". Works on ntfs or ext4 partitions.
altair4
Level 20
Level 20
Posts: 11453
Joined: Tue Feb 03, 2009 10:27 am

Re: How to stop other partitions from auto-mounting

Post by altair4 »

The only way I can reproduce your experience is if the either partition is mounted under /media not /mnt.

Then two different processes converge. The "noauto" and the default mechanism which is engaged when something is mounted under /media or under the user's home directory. The "user" option will still be ignored since it has no meaning with ntfs. If it's mounted under /mnt what you describe cannot happen.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
beng12

Re: How to stop other partitions from auto-mounting - solved

Post by beng12 »

altair4 -- got it. Thanks.
Locked

Return to “Xfce”