DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 13th October 2024
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 89
Default How to set ZFS module parameters?

I have a VBox VDI with FreeBSD on ZFS.
Code:
df -h /
says that only around 8 GB is used, yet the VDI is 23 GB large. Snapshots are already deleted with
Code:
zfs list -H -o name -t snapshot | xargs -n1 zfs destroy -R
so, the VDI is not big because of them. I know i can compact the disk image with
Code:
VBoxManage modifymedium --compact {UUID}
but that will only remove zero-filled blocks from the VDI. Blocks that contain data from deleted files will remain, so they must be zeroed out.

On most filesystems, one can do
Code:
dd if=/dev/zero of=whatever bs=16777216
until the filesystem become full and then do
Code:
rm whatever
and the blocks will be zeroed out. But not on ZFS.

I found that i have to do
Code:
zpool initialize <pool name>
but that will fill the blocks with
Code:
DE AD BE EF DE AD BE EE
instead of zeroes.

FreeBSD manual says that the ZFS module parameter called
Code:
zfs_initialize_value
should be set. I found somewhere, that i can do that by
Code:
set zfs:zfs_initialize_value=0
but i could not find where i must do that.

OmniOS manual says, that this line should be in
Code:
/etc/system
or alternatively i can do
Code:
pfexec mdb -kwe 'zfs_initialize_value/z0'
but FreeBSD has neither
Code:
/etc/system
nor
Code:
pfexec
so i cannot do these.

OpenZFS manual says, that the parameters are available in
Code:
/sys/module/zfs/parameters/
and they can be set at boot time in
Code:
/etc/modprobe.d/zfs.conf
but FreeBSD has neither
Code:
/etc/modprobe.d
nor SysFS. (The manual page does not mention that this would be Linux-only and contains FreeBSD-related information too.)

Question is: where can i set
Code:
zfs_initialize_value
to zero?
Reply With Quote
  #2   (View Single Post)  
Old 13th October 2024
Maxnix's Avatar
Maxnix Maxnix is offline
Port Guard
 
Join Date: Feb 2016
Posts: 29
Default

You can set these parameters using sysctl(8). In this case this should do:
Code:
sysctl vfs.zfs.initialize_value=0
__________________
The world doesn't live off jam and fancy perfumes - it lives off bread and meat and potatoes. Nothing changes. All the big fancy stuff is sloppy stuff that crashes. I don't need dancing baloney - I need stuff that works. -- Theo de Raadt
Reply With Quote
  #3   (View Single Post)  
Old 13th October 2024
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 89
Default

Thank you very much, that worked. Unfortunately the VDI did not become smaller after initializing the pool and compacting the image, so there must be something else there, than unused blocks.

I've opened a topic for it.

Last edited by TCH; 13th October 2024 at 01:24 PM. Reason: Continued in related topic.
Reply With Quote
Reply

Tags
freebsd, module, omnios, parameter, zfs

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modem throws CME ERROR 50 (incorrect parameters) on ATH1 TCH General software and network 5 17th February 2024 12:35 AM
Shell script arguments or parameters held in '$@' and '$*' J65nko Guides 2 12th June 2021 06:23 PM
Where is Qt uiTools module? gustaf OpenBSD Packages and Ports 2 10th July 2018 09:44 AM
pf.conf(5) missing some parameters? notooth OpenBSD Security 2 20th December 2017 12:31 AM
Failed to load module "qxl" (module requirement mismatch) KenJackson NetBSD Installation and Upgrading 3 10th January 2017 09:18 AM


All times are GMT. The time now is 12:06 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick