Wednesday 10 June 2009

The 3 ways to stop gnome automounting

Problem I had some hard drive slices I didn't want gnome to mount when it started up. On first glance I didn't think this was so hard to fix. However after a bit of fruitless googling, I was none the wiser of where I would go to stop the auto mounting. I knew it was happening in gnome somewhere, but where. The journey On reading a blog about the new geom functionality in FreeBSD 7.2 I tried to change my fstab file. A few kernal panics later I have the file correct with the slice names in the file and the noauto option set but that did not to work. After more googling I hit upon the solution of turning off auto-mounting completely in Nautilus using a configuration setting. This works, but it seems to be a little heavy handed as it would stop my CD-ROM from auto-mounting when I put a disk in. So I followed the code back in Nautilus and I found that it was just asking HAL and the fstab file what drives it could mount and then mounting them, so my next solution was to make HAL ignore the slices, much reading later I had a fdi file that ignored the geom labels. This worked, but again I was troubled as to why the noauto route didn't work as it should. This is when I re-read the blog post again, and worked out that you should reference the slices with the geom label names rather than the slice names. It seems that the new GEOM functionality leaves the labels active and then HAL picks them up and offers them to Nautilus, so you have to set them in the fstab to noauto. Solutions
  1. As of Gnome 2.22 Nautilus is responsible for doing the auto-mounting so the first solution is to turn off all auto-mounting completely in nautilus. We can do this by setting the configuration
    /apps/nautilus/preferences/media_automount
    to false. You can do this with the configuration editor or from the shell with
    gconftool-2 -s --type bool /apps/nautilus/preferences/media_automount false
    The problem with this solution is that it will stop Nautilus from auto-mounting anything.
  2. The next option is to make HAL ignore the slices so they are not exposed to Nautilus. The way to do this is to create a fdi file that will tell HAL what to do. You can list the hal properties of everything on you system with lshal in my case the key is block.device and we can use the contains_ncase to find the slices we want to ignore.
    <?xml version="1.0" encoding="UTF-8"?>
    
    <deviceinfo version="0.2">
      <device>
        <match key="block.device" contains_ncase="/dev/ufsid/">
            <merge key="info.ignore" type="bool">true</merge>
        </match>
      </device>
    </deviceinfo>
    This works, but again it seems to be a bit of over kill.
  3. The last solution is to set your fstab file to set the noauto option. This is the most simple. Just make sure to us the glabel name for the slice
Links to supporting docs

No comments: