Jump to content

fstab does not prevent auto mounting


llamafilm
 Share

5 posts in this topic

Recommended Posts

In the past, on real macs, I have used the fstab file to prevent auto-mounting drives, for example the other OS drives in a multi-boot scenario. But it's not working on my Hackintosh. In Sierra, I use vifs to edit the fstab file, but it is ignored, and the other two volumes are mounted automatically at boot. Below is the contents of /etc/fstab.

 

# Warning - this file should only be modified with vifs(8)
# Failure to do so is unsupported and may be destructive.
#
WindowsUUID=0EC23A58-2503-48E4-88FB-3F13F1F80F6A       none    ntfs    ro,noauto
yosemiteUUID=66A393D3-C723-42D6-89A3-EA68B961FFF3       none    hfs     rw,noauto
Edited by llamafilm
fixed formatting
Link to comment
Share on other sites

I've had issues with using the Volume UUID in fstab as well in cases specific to NTFS volumes, but I've found that using LABEL= seemed to always work. Regardless I wanted to try it out again just for the sake of this thread. Testing it in 10.12.3:

 

First I tried blocking via UUID and reboot:

UUID=F2F62E40-6D42-48DF-A4B6-5825A3C8E1BA none ntfs ro,noauto

It didn't work. Next I try LABEL and reboot:

LABEL=Windows none ntfs ro,noauto

That worked as I expected. I do have an extra HFS+ partition to try the UUID with. So I go ahead and do that:

UUID=B50DF212-0CA5-3933-A120-C7F282135FD7 none hfs rw,noauto

That worked. Let's make sure the NTFS line still doesn't. So I re-add the line I previously tried:

UUID=F2F62E40-6D42-48DF-A4B6-5825A3C8E1BA none ntfs ro,noauto

And it prevented both from mounting. I used the exact syntax and whitespace - no difference at all.

 

Now the UUID line for NTFS seems to work fine by itself. It doesn't matter if I remove it or re-add it, it just seems to work fine.

 

/etc/fstab is read by diskarbitrationd and looking at some of its code it seems to follow some standard rules in determining if it's a legit UUID and follows through with it.

 

There's a known problem with NTFS partitions having UUID issues but that doesn't explain why things worked out for me in the way it did. So yeah I have no idea why it wasn't working before and now it is, but that's what's happening on my system. *shrugs*

 

As you mention you even have issues doing it with HFS+ - I've never had issues with blocking mounts via UUID in fstab when it came to HFS+ partitions myself.

Link to comment
Share on other sites

When I switched from UUID to LABEL, it correctly blocks mounts for both HFS and NTFS. Weird.

I asked this same question over on Ask Different forums, and got no response, so I think this is somehow related to Hackintosh, rather than buggy diskarbitration code. No idea what causes it though.

Link to comment
Share on other sites

  • 6 months later...

First, diskarbitration takes cares of mounting through Launched, so unload it - editing /private/etc/fstab won't do:

 

diskarbitrationd listens for connections from clients, notifies clients of the appearance

     of disks and filesystems, and governs the mounting of filesystems and the claiming of
     disks amongst clients.
 
     diskarbitrationd is accessed via the Disk Arbitration framework.  This command is not
     intended to be invoked directly.
 
     Options:
 
     -d       Report detailed information in /var/log/diskarbitrationd.log.
 
     The file /etc/fstab is consulted for user-defined mount points, indexed by filesystem, in
     the mount point determination for a filesystem.  Each filesystem can be identified by its
     UUID or by its label, using the constructs ``UUID'' or ``LABEL'', respectively.  For
     example:
 
        UUID=DF000C7E-AE0C-3B15-B730-DFD2EF15CB91 /export ufs   ro
        UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none    hfs   rw,noauto
        LABEL=The\040Volume\040Name\040Is\040This none    msdos ro
 
FILES
     /etc/fstab
     /var/log/diskarbitrationd.log
     /var/run/diskarbitrationd.pid
     /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist`
 
man has from time to time some useful info instead of normal Apple 3 liners
man diskarbitrationd
 
if you run it with sudo and -d flag, despite the fact the man says you shouldn't hehe, it will tell you if
something is wrong within the fstab or not (like it f**n couldn't do so in the log file...) like this:
 
fstab: /etc/fstab:3: Inappropriate file type or format
fstab: /etc/fstab:4: Inappropriate file type or format
fstab: /etc/fstab:5: Inappropriate file type or format
fstab: /etc/fstab:6: Inappropriate file type or format
 
cat /private/etc/fstab | pbcopy
 
 
UUID=6B455C69-D1C9-4BC6-8B10-C4E9C64A2A03 none msdos rw,noauto
UUID=78A5ABE5-0AD8-E746-9192-9532E45526A9 none ntfs rw,noauto
UUID=30723348-9108-0544-B2BA-D4903B48769D none ntfs rw,noauto   o
UUID=D14906F2-4F56-41CC-896B-F53D3378508D none msdos rw,noauto  m
UUID=4452BC2B-0B9B-32C3-A62B-F5C7FFAC74CC none none rw,noauto   f
UUID=D14906F2-4F56-41CC-896B-F53D3378508D none none rw,noauto   g
UUID=5FBD02D3-3743-3A3F-BF53-100A8785FAB2 none none rw,noauto
UUID=42A3C6F0-A9D2-4B7A-9524-9BECD92D6885 none none rw,noauto
UUID=EA2E36CE-1418-4DFF-9F6C-5B52383E1650 none none rw,noauto
UUID=89CD05CD-4467-4FD3-BAB6-27EBCACCC217 none none rw,noauto
UUID=FAF231A4-3DD1-32F4-85F5-510B90E11175 none none rw,noauto
UUID=6B455C69-D1C9-4BC6-8B10-C4E9C64A2A03 none none rw,noauto
 
as you can see it does complain about omfg from line 3 to 6, you can also drop the
mount point, fs bundle and use none, none , diskutility will sniff the fs type anyways
and mount it for ya later
 
 
to unload / load:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist

 

 
or use LaunchControl.app since editing those can be annoying and LaunchControl.app
gives you hell a lot more control over what your os is doing

if the above is TL;DR go here and profit: https://github.com/aburgh/Disk-Arbitrator

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...