Page 1 of 1

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

Posted: Fri Jun 26, 2020 5:17 am
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.

Re: How to stop automatic mounting of disks/partitions

Posted: Fri Jun 26, 2020 5:48 am
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).

Re: How to stop automatic mounting of disks/partitions

Posted: Mon Jun 29, 2020 4:28 am
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?

Re: How to stop automatic mounting of disks/partitions

Posted: Tue Jun 30, 2020 6:25 am
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)