Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ZFS: What is kernel "static installs"?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 435
Location: Hong Kong

PostPosted: Wed May 18, 2022 4:40 pm    Post subject: ZFS: What is kernel "static installs"? Reply with quote

Previous subject: Cannot create zpool: feature 'dedup' unsupported by kernel ?
[SOLVED] dedup is a zfs filesystem property, rather than a zpool feature. We can also specific it while zpool create by -O, the capital letter O.

- - - -

I am using the Gentoo 5.15.26 kernel. Sort of new and basic kernel.:
% eselect kernel show
Current kernel symlink:
  /usr/src/linux-5.15.26-gentoo

I wish to create zpool with deduplication. But it complains ...:
# zpool create -o feature@dedup=on zpool_baze mirror /dev/sda /dev/sdb
cannot create 'zpool_baze': feature 'dedup' unsupported by kernel

- - - -

May be related. May be not.

Reference to the ZFS wiki, I am not sure why I do not have CONFIG_SPL. What does SPL means? What does CONFIG_SPL do?
https://wiki.gentoo.org/wiki/ZFS#Advanced

Code:
% grep -ie _zfs -ie _spl /usr/src/linux/.config
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
CONFIG_ZFS=y


In addition, what does "static installs" means? Does it mean not using the "Distribution Kernel"? I do not prefer using Distribution Kernel.

Quote:
Installing into the kernel directory (for static installs)

_________________
- midnite.


Last edited by midnite on Thu May 19, 2022 7:01 am; edited 2 times in total
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed May 18, 2022 4:59 pm    Post subject: Reply with quote

Hi
zfs is not native to the kernel tree.
You install it by
Code:

emerge -av zfs

This will pull the zfs-kmod ie the zfs kernel modules along with the zfs userspace utils and also the so called "spl".
It means
Solaris Porting Layer (SPL) and is a Linux kernel module which provides many of the Solaris kernel APIs.
See my /usr/src
Code:

ls /usr/src
linux  linux-5.12.9-gentoo  linux-5.13.13-zen  linux-5.16.2-gentoo  linux-5.17.1-gentoo-r1  spl-2.1.99  zfs-2.1.99

Therefore you do NOT need and in fact should not include any zfs-specific config in your .config.
_________________
:)
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 435
Location: Hong Kong

PostPosted: Wed May 18, 2022 5:24 pm    Post subject: Reply with quote

Thank you for reply, alamahant.

I am sorry I forgot to mention I have already installed zfs and zfs-kmod. After kernel compile, I have also rebuilt modules, rebuilt initramfs (this is not related), and reboot.

Code:
# qlist -vIRUS zfs
sys-fs/zfs-2.1.4:0::gentoo -custom-cflags -debug -dist-kernel -kernel-builtin -minimal nls pam -python -python_targets_python3_10 -python_targets_python3_8 python_targets_python3_9 rootfs split-usr -test-suite -verify-sig
sys-fs/zfs-kmod-2.1.4-r1:0::gentoo -custom-cflags -debug -dist-kernel rootfs -verify-sig


But I still cannot create zpool with the dedup option. Without dedup option, it is ok.

alamahant wrote:
Therefore you do NOT need and in fact should not include any zfs-specific config in your .config.


Do you mean I should inculde CONFIG_SPL and CONFIG_ZFS as modules? I need ZFS on Boot, on Swap, and on Root.
_________________
- midnite.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed May 18, 2022 6:41 pm    Post subject: Reply with quote

It means in your /usr/src/linux/.config you should NOT include any zfs clauses.
No CONFIG_SPL and CONFIG_ZFS nothing.
As for the dedup issue there is no feature to be specified @creating zpool.
Rather you enabled it afterwards.
Code:

zpool create -o feature@dedup=on zpool_baze /dev/sdc22 -f
cannot create 'zpool_baze': feature 'dedup' unsupported by kernel
zpool create zpool_baze /dev/sdc22 -f
zfs get dedup zpool_baze
NAME        PROPERTY  VALUE          SOURCE
zpool_baze  dedup     off            default
zfs set dedup=on  zpool_baze
zfs get dedup zpool_baze
NAME        PROPERTY  VALUE          SOURCE
zpool_baze  dedup     on             local


Code:

I need ZFS on Boot, on Swap, and on Root.

Ok plz follow the procedure about root-on-zfs.
I like this
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Buster%20Root%20on%20ZFS.html
_________________
:)
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 435
Location: Hong Kong

PostPosted: Thu May 19, 2022 5:44 am    Post subject: Reply with quote

Thank you very much alamahant for testing it for me. It works for me now to enable it afterwards. Thank you also that I have read through the openzfs installation docs. I find out that dedup is a zfs filesystem property, rather than a zpool feature. We can also specific it while zpool create by -O, the capital letter O.

Code:
zpool create -O dedup=verify -O atime=off -O xattr=sa zpool_baze mirror /dev/mapper/luks_yyyymmdd_xxx /dev/mapper/luks_yyyymmdd_yyy


As for CONFIG_SPL and CONFIG_ZFS, I just notice I have the /usr/src/spl-x.x.xx and /usr/src/zfs-x.x.xx directories too. They are new to me. May I ask what are they? They do not seem like kernels.

Code:
# ls /usr/src/
linux  linux-5.10.100-gentoo  linux-5.10.52-gentoo  linux-5.10.76-gentoo-r1  linux-5.10.88-gentoo  linux-5.10.93-gentoo  linux-5.15.11-gentoo  linux-5.15.16-gentoo  linux-5.15.23-gentoo  linux-5.15.26-gentoo  linux-5.15.32-gentoo-r1  spl-2.1.4  zfs-2.1.4


Sorry to ask this over and over again. It is because it seems strange to me. CONFIG_ZFS enables ZFS filesystem support in the kernel. Should I really disable it?

Back to the Gentoo ZFS wiki. May I know what does "static installs" mean?
https://wiki.gentoo.org/wiki/ZFS#Advanced

Code:
  ┌────────────────── Search Results ───────────────────┐
  │ Symbol: ZFS [=y]                                    │ 
  │ Type  : tristate                                    │ 
  │ Defined at fs/zfs/Kconfig:1                         │ 
  │   Prompt: ZFS filesystem support                    │ 
  │   Depends on: BLOCK [=y] && EFI_PARTITION [=y]      │ 
  │   Location:                                         │ 
  │ (1) -> File systems                                 │ 
  │ Selects: ZLIB_INFLATE [=y] && ZLIB_DEFLATE [=y]     │ 


Edit:

I found this discussion about the Gentoo ZFS wiki about the "Installing into the kernel directory (for static installs)" section. Some suggest that we can simple skip that section.
https://linux.gentoo.user.narkive.com/q29uemW5/gentoo-user-zfs-wiki-confusion

During their discussion 9 years ago, there was a -static-libs USE flag at sys-fs/zfs. We do not have it anymore. Is it related to the "static installs"?

Quote:
'emerge zfs' shows:
Calculating dependencies... done!
[ebuild N ] sys-fs/zfs-0.6.1 USE="rootfs -custom-cflags
(-kernel-builtin) -static-libs -test-suite" 1,500 kB
[ebuild N ] sys-fs/zfs-kmod-0.6.1 USE="rootfs -custom-cflags -debug"
0 kB
[ebuild N ] sys-kernel/spl-0.6.1 USE="-custom-cflags -debug
-debug-log" 209 kB

Quote:
ah! so the 'static' is a reference to non-modular kernel builds. got it.

"Static installs" means compiling CONFIG_ZFS into the kernel, rather than build as module?

If we did not run the ./copy-builtin command in that section, I guess we will not have the /usr/src/spl-x.x.xx and /usr/src/zfs-x.x.xx directories.

If we are using ZFS for ROOT, as well as BOOT, we will need ZFS support in the initramfs. I think this needs ZFS be turned ON in the kernel, so that ZFS support will be pulled into the initramfs. Is this understanding correct?
_________________
- midnite.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Thu May 19, 2022 9:35 am    Post subject: Reply with quote

Quote:

Sorry to ask this over and over again. It is because it seems strange to me. CONFIG_ZFS enables ZFS filesystem support in the kernel. Should I really disable it?

I use zfs without any problem whatsoever.
Here is my .config
Code:

grep -i zfs /usr/src/linux/.config
<nothing-to-show>


Quote:

If we are using ZFS for ROOT, as well as BOOT, we will need ZFS support in the initramfs. I think this needs ZFS be turned ON in the kernel, so that ZFS support will be pulled into the initramfs. Is this understanding correct?

Not quite. Grub and the initrd(preferably dracut) will handle all that.
Its the same like for example ext4 configured as module.
It is contained in the initrd to enable mounting the / partition.
If you are not using initrd then yes you need it in-built in the kernel.
Quote:

As for CONFIG_SPL and CONFIG_ZFS, I just notice I have the /usr/src/spl-x.x.xx and /usr/src/zfs-x.x.xx directories too. They are new to me. May I ask what are they? They do not seem like kernels.

They contain kernel modules originally from solaris and needed for zfs to function in Linux.
https://github.com/openzfs/spl
Quote:

During their discussion 9 years ago, there was a -static-libs USE flag at sys-fs/zfs. We do not have it anymore. Is it related to the "static installs"?

In my very limited understanding "static-libs" means all libs needed for a binary to function are included built-in in the binary as opposed to dynamically linking to them at runtime.
_________________
:)


Last edited by alamahant on Thu May 19, 2022 9:58 am; edited 5 times in total
Back to top
View user's profile Send private message
midnite
Guru
Guru


Joined: 09 Apr 2006
Posts: 435
Location: Hong Kong

PostPosted: Thu May 19, 2022 9:42 am    Post subject: Reply with quote

I see. Thank you alamahant for clarification. I will try it out.
_________________
- midnite.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum