Skip to content

Instantly share code, notes, and snippets.

@JavaScriptDude
Last active February 14, 2024 20:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JavaScriptDude/bdb60ec8801b1ff28c495a2485b6b13b to your computer and use it in GitHub Desktop.
Save JavaScriptDude/bdb60ec8801b1ff28c495a2485b6b13b to your computer and use it in GitHub Desktop.
Linux Mint 21.1 ZFS Root Installation Notes
When installing Linux Mint, you can install with ZFS Root by following standard instructions.
However, there is an issue with almost all Linux distributions default ZFS install script where the
allocated spaces for the partitions are a bit too small for real world ZFS Use.
These instructions show how to alter the ZFS setup script to have a more appropriate partition spacing.
Boot into the Linux Mint OS USB stick, and:
```
sudo su
cd /usr/share/ubiquity/
cp ./zsys-setup ./zsys-setup_orig
vi zsys-setup
```
You can use gedit or any other command line editor of your choice.
<br/>
### Swap File Size
Near the top of `format_disk() {` change:
```
ss="$6"
```
to:
```
ss="8192"
```
This is the size of the swap file. Set value to what you desire. Default is 2GB.
One article talking about this topic: https://opensource.com/article/19/2/swap-space-poll
<br/>
#### Swap Size Percent Comment (optional)
Change:
```
# bpool size: 500M < 5% of ZFS allocated space < 2G
```
to:
```
# bpool size: 500M < 20% of ZFS allocated space < 10G
```
The above is just a comment, but it's best to update it so as to avoid confusion as you work.
<br/>
### Swap Size Percent
Change:
```
size_percent=$(expr \( $(blockdev --getsize64 ${partprefix}${partswap}) / 1024 / 1024 \) \* 5 / 100)
```
to:
```
size_percent=$(expr \( $(blockdev --getsize64 ${partprefix}${partswap}) / 1024 / 1024 \) \* 20 / 100)
```
The above line checks the size of memory and changes swap file size accordingly, usually
it's 5% of memory or a maximum of only 2 GB.
<br/>
### BPool Size
Change:
```
[ ${bpool_size} -gt 2048 ] && bpool_size=2048
```
to:
```
[ ${bpool_size} -gt 10240 ] && bpool_size=10240
```
Sets the bpool size (rpool size is just whatever free space is left over after you've got all the other partitions set up).
<br/>
### Verify Changes
Save the file and do a diff to verify:
```
diff zsys-setup zsys-setup_orig
```
Once you are satisfied, start the `Install Linux Mint` and choose Advanced -> ZFS.
<br/>
Note: Encryption is recommended for the security conscious.
@JavaScriptDude
Copy link
Author

Inspiration for the zsys-setup tweaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment