Skip to contentSkip to conversation

Prevent auto-mounting?

DISCUSSION Gary Thomas 1 participant 2 messages Oct 28, 2011 – Oct 31, 2011

lore
Share & tools
lore
#0 lore raw

How do I keep a file system from being automatically mounted? In particular, I want to automate this sequence:
* [re]partition a disk using sfdisk
* format the partitions
* mount & use the partitions

The problem I have is that when sfdisk completes and the disk label is reread by the kernel, some process(?) goes off and tries to mount the partitions. This not only gets in the way of reformatting those partitions, but it may be 100% incorrect as the disk layout may have changed.

Any ideas what process is doing this and how I stop it?

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#1 lore raw
Quoted 6 lines · Gary Thomas

How do I keep a file system from being automatically mounted? In particular, I want to automate this sequence:
* [re]partition a disk using sfdisk
* format the partitions
* mount & use the partitions

Quoted 8 lines

The problem I have is that when sfdisk completes and the disk label is reread by the kernel, some process(?) goes off and tries to mount the partitions. This not only gets in the way of reformatting those partitions, but it may be 100% incorrect as the disk layout may have changed.

Any ideas what process is doing this and how I stop it?

I found that adding the device to /etc/udev/mount.blacklist prevents the device from being mounted just after being [re]partitioned. In my case, this command does the trick:

  # echo /dev/mmcblk0p1 >>/etc/udev/mount.blacklist
Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------