Stop ZFS/opensolaris from autoloading?

Frank Leonhardt frank2 at fjl.co.uk
Fri Jul 21 00:14:19 UTC 2017


On 19/07/2017 03:31, Dan Mahoney, System Admin wrote:
> On Tue, 18 Jul 2017, Frank Leonhardt wrote:
>
>> On 01/05/2017 00:17, Dan Mahoney wrote:
>>       Short of renaming the modules (which breaks upgrades and is 
>> unpredictable) is there any easy way to stop a system from 
>> auto-loading the ZFS
>>       modules?
>>
>>       We've got some memory-constrained systems and the concept of 
>> "modules that load themselves" somewhat bugs me.
>>
>>       I'd rather "zpool status" (which is often called by things like 
>> Facter) simply return an error than load a kernel module that will 
>> never be
>>       used.
>>
>>
>> I've not had that problem myself, but my inclination would be to make 
>> sure it's not loaded or compiled in the kernel (obvious) and then simply
>> rename/replace all the zxxxx executables with scripts that do what I 
>> want. Less intrusive fiddling that way.
>
> That also breaks freebsd-update.  You're on to something, however.  I 
> wonder if chmod'ing the appropriate files 000 will stop it, or 
> chmod'ing the kernel module 000. 

There are stronger ways of making files immutable but I don't think it's 
the way. Just run a script after the update:

echo exit 1 >/sbin/zfs
echo exit 1 >/sbin/zpool
...
chmod a+x /sbin/z*

You could even put it in rc.local and have it re-patched every time you 
boot. I do something similar for modifications; it helps to keep a 
record of everything that's changed in a system in one place for all 
sorts of reasons. For example, I put a wrapper around "shutdown" on 
remote servers so I don't accidentally "shutdown -p now" anything in a 
data centre. thinking I'm turning off my local box.

Regards, Frank.



More information about the freebsd-questions mailing list