Disk Mount – How to Stop Disks from Being Automounted on Boot?


I have a btrfs filesystem RAIDed across several disks. The machine is connected via USB to an external hard-drive bay where three disks live.

In my fstab I have a mount entry for one of the disks and the path (/dev/sdb). However, during boots Ubuntu mounts all of the disks /dev/sdc and /dev/sdd. I'd like to stop Ubuntu from mounting the other disks during boot. Is there anyway to disable auto-mounting of attached disks on boot with the exception of the ones explicitly in /etc/fstab?

Here are the contents of fstab

proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=eb80bbb0-7b27-4b7c-b041-639cbcae1c77 /           ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=0e0c01be-7545-449c-86a8-60309d016534 none        swap    sw              0       0
/dev/sdb /media/xbmc    btrfs   defaults  0 1

When the machine boots I find something like this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       294G   35G  245G  13% /
udev            2.0G  4.0K  2.0G   1% /dev
tmpfs           791M  892K  790M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            2.0G  1.6M  2.0G   1% /run/shm
/dev/sdc        4.6T  1.3T  2.6T  34% /media/0868831f-d234-4172-aeab-640e580190d0
/dev/sdd        4.6T  1.3T  2.6T  34% /media/0956647d-a558-2218-febt-559a647221r5
/dev/sdb        4.6T  1.3T  2.6T  34% /media/xbmc

Best Answer

The noauto option for mount lets the user to mount the device/partition concerned only explicitely, not with mount -a or not on boot if mentioned in /etc/fstab's option column for the concerned device. If you can add /dev/sdc and /dev/sdd(or their UUIDs) in /etc/fstab and provide the noauto option in option(4th) column they won't be mounted automatically.

(see the man page for mount or this)

Related Question