-
-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for incremental changes #568
Conversation
ec6453e
to
275a412
Compare
5df2a96
to
00602b0
Compare
00602b0
to
f6b72bf
Compare
if ! (blkid '${config.device}' -o export | grep -q '^TYPE='); then | ||
mkfs.btrfs "${config.device}" ${toString config.extraArgs} | ||
fi | ||
if (blkid "${config.device}" -o export | grep -q '^TYPE=btrfs$'); then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that this is causing syntax error near unexpected token `fi'
when formatting a btrfs filesystem without any swap or subvolume configuration.
I guess this all should be gaurded by config.swap
& config.subvolumes
being set? It's a bit annoying bash doesn't support empty if statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplest fix would be echo -n ""
in the first line.
Is there documentation on how to use this? |
Thanks to nix-community/disko#568 it is possible to change the drive configuration of an existing setup. Also, I checked the source and options are set via `zfs set` except for some special ones (like `mountpoint`) that are set with `-o` during creation, so I can add the `com.sun:auto-snapshot` option here.
Thanks to nix-community/disko#568 it is possible to change the drive configuration of an existing setup. Also, since nix-community/disko#689 disko also incrementally sets options via `zfs set` except for some special ones (like `mountpoint`) that are set with `-o` during creation, so I can add the `com.sun:auto-snapshot` option here.
@gabevenberg Basically, run this:
This outputs a path to the script that will be run once you remove Then, run the same command without Be aware that this is only additive. When you add drives and partitions, they will be formatted as desired, but when you remove them from the config, they just become unmanaged. Same for zfs datasets and their options. Adding options will set them, but removing options will not remove them from the dataset. |
@iFreilicht So to be 100% clear... of the possible CRUD operations it will only do a Create but not the Update (modify) or Delete existing partitions when using |
@iFreilicht i just rebooted the VM and now it doesn't boot at all. it appears that it may have reformated the root drive even though i didn't change that part of the disk-config.nix. update: |
No we don't support ext4 to btrfs conversion for now. |
Not quite. Update is partially supported for some things like updating the mountpoint of a zfs dataset. The cases where this works are limited, though and there is no comprehensive list of this. That's why I specifically wrote in my instructions that you should use
Are you sure that's all you did? Maybe you also did a |
For future improvements, it might be possible to use custom ZFS properties, zfs history, and/or some other form of examining zfsprops to check what the delta changes are for additional error handling (i.e. dataset has been modified since last run, refusing to overwrite), viewing changes (i.e. datasets exist on device that don't exist in disko config) etc. Just a random thought I had. |
rework of #435 with a smaller (and more logical) scope