[SOLVED] How to stop automatic mounting of disks/partitions

Need support for GhostBSD. Ask here if your question does not fit elsewhere.
Post Reply
mario69
Posts: 3
Joined: Thu Jun 25, 2020 5:59 am

[SOLVED] How to stop automatic mounting of disks/partitions

Post by mario69 »

Hello, I have three separate disks, ada0, ada1 and ada2. GhostBSD is on ada1.

I'm trying to figure out a way to prevent my system from mounting ada0 and ada2 and all their partitions automatically. There is no mention of them in /etc/fstab.

I've added

Code: Select all

autofs_enable="NO"
hald_enable="NO"
in /etc/rc.conf but it has made no difference.

Also, I used Mate and now Xfce4 and I have set org.gnome.desktop.media-handling automount to false.

Any suggestions? Thank you.
Last edited by mario69 on Tue Jun 30, 2020 6:28 am, edited 1 time in total.
ouaille_aime_scier_
Posts: 71
Joined: Sun Sep 01, 2019 1:38 pm

Re: How to stop automatic mounting of disks/partitions

Post by ouaille_aime_scier_ »

Hello mario69, GhostBSD use OpenRC as init system so you can desactivate hal with the rc-update delete hald command (presuming hald service is in rhe default level).
mario69
Posts: 3
Joined: Thu Jun 25, 2020 5:59 am

Re: How to stop automatic mounting of disks/partitions

Post by mario69 »

Thank you @ouaille_aime_scier_ , I don't think hald is running. It is not listed when I issue

Code: Select all

rc-update show
or

Code: Select all

ps aux
In /var/log/automount.log I have entries like

Code: Select all

2020-06-29 06:29:29 /dev/ada0: attach
2020-06-29 06:29:29 /dev/ada0p2: attach
2020-06-29 06:29:29 /dev/ada0p2: create '/media/ada0p2' dir
2020-06-29 06:29:29 /dev/ada0p2: fsck.ext4 linux: clean, 89266/655360 files, 956289/2621440 blocks
2020-06-29 06:29:29 /dev/ada0p2: mount OK: 'lklfuse -o type=ext4 -o allow_other -o intr -o uid=1000 -o gid=0 -o umask=002 /dev/ada0p2 /media/ada0p2'
2020-06-29 06:29:31 /dev/ada0p2: chown '/media/ada0p2' dir with 'mario:wheel' rights
but I don't want any of that to happen. I want ada0 and other partitions on other disks to be left alone and only mounted manually by me if needed.

Is there a way to achieve that?
mario69
Posts: 3
Joined: Thu Jun 25, 2020 5:59 am

Re: How to stop automatic mounting of disks/partitions

Post by mario69 »

OK, I solved this by editing /usr/local/etc/devd-openrc/automount_devd.conf and commenting out this whole section

Code: Select all

# Internal drive
#notify 100 {
#	match "system" "DEVFS";
#	match "type" "CREATE";
#	match "cdev" "(ada)[0-9]+.*";
#	action "/usr/local/sbin/automount $cdev attach &";
#};
and removing 'ada' from

Code: Select all

match "cdev" "(da|mmcsd|ugen|ada)[0-9]+.*";
in the section

Code: Select all

# PENDRIVE/PHONE/SDCARD insert
In this way all adaX disks are left alone (except of course the one where GhostBSD is installed)
Post Reply