ZFS on Linux uses the Adaptive Replacement Cache (ARC) to store frequently accessed data in memory. On Ubuntu/Debian, you can set the size of the ARC by modifying the kernel parameters.
- Check your current ARC size by running the following command:
cat /proc/spl/kstat/zfs/arcstats
- To set the ARC size, you will need to add a kernel parameter to the GRUB configuration file. Open the file using your preferred text editor:
sudo nano /etc/default/grub
- Add the following line to the GRUB_CMDLINE_LINUX_DEFAULT variable, replacing [size] with the desired size in bytes:
GRUB_CMDLINE_LINUX_DEFAULT="... zfs_arc_max=[size] ..."
- Save and close the file.
- Update the GRUB configuration by running the following command:
sudo update-grub
- Reboot the system for the changes to take effect.
- After reboot, you can check the current ARC size again using the command from step 1 and confirm that it matches the value you set in step 3.
Note: The maximum size of the ARC depends on the amount of physical memory in your system and the current usage of the memory. It is recommended to set the ARC size to less than 50% of the available memory.