I would like to stop Ubuntu from mounting my other (Windows) partitions automatically since I do not need it very often, I would like not to automount "System reserved" partition for Windows.
There is a similar question here:
How can I stop Ubuntu 12.04 from mounting Fedora 16's Swap Partition?
However, I do not have these partitions added in
How can I do it ?
For proof, my
proc /proc proc nodev,noexec,nosuid 0 0 # / was on /dev/sda7 during installation UUID=1384cee0-6a71-4b83-b0d3-1338db925168 / ext4 errors=remount-ro 0 1 # swap was on /dev/sda6 during installation UUID=e3729117-b936-4c1d-9883-aee73dab6729 none swap sw 0 0 #------ MY WINDOWS D DRIVE---------- I WANT TO KEEP IT UUID=98E8B14DE8B12A80 /media/d ntfs defaults,errors=remount-ro 0 0
The solution is to add them to
/etc/fstab, but with options to prevent them from being automatically mounted. The option you want is
noautorather than auto. For example, to prevent a windows partition from being mounted, you could add an entry like the following:
UUID=C2A281E4A281DCF3 /media ntfs-3g defaults,noauto 0 0
You can run
blkidto retrieve the partition UUID:
See "Using UUID" in the Ubuntu Docs.
Or, to make it more self-documenting and simpler, although not quite as fail-proof, I have switched to using disk labels rather than UUIDs. You just need to make sure the label is descriptive and unique; unlike using UUIDs, labels are not guaranteed to be unique, but I've never run into a problem, and it's more convenient, as you can swap a different partition by using the same label, and no need to modify
/etc/fstab, or to run
Contrast the above entry with this one:
A good explanation of fstab options can be found on the ArchWiki and on the Ubuntu Docs.