Commit graph

136 commits

Author SHA1 Message Date
Leonie Marcy Vack
c53bfaa13a zfs_volume: fix eval of _unmount if content is null 2025-01-16 14:46:04 +01:00
Jörg Thalheim
7ea6edd857 zfs-with-vdevs: add an example for using absolute device paths
This is the only way to assign devices rather than fixed gpt partitions.
Without reading the code it's not very obvious how disko actually
assigns devices to zpools.
2024-12-24 14:45:56 +01:00
Jörg Thalheim
d8f3cfc582 zfs: run load-key on mount 2024-12-20 14:24:53 +01:00
neox
a0c967fef4 Add extraArgs to zfs_volume.
Update lib/types/zfs_volume.nix
2024-12-13 11:16:40 +01:00
Felix Uhl
67a130b984 tree-wide: Remove all uses of lib.mdDoc
This was deprecated in 24.05 already, and removed in 24.11.
2024-12-02 20:28:17 +01:00
Jörg Thalheim
aa006252c8 add unmount feature 2024-11-29 14:44:15 +01:00
Gary Guo
3e83c11038 Fix evaluation when a GPT partition is left unformatted 2024-11-25 02:10:48 +00:00
Jörg Thalheim
0433c7e883 also passthrough rootfs mountoptions 2024-11-24 18:39:57 +01:00
Jörg Thalheim
fd3e326e9a disable swap in disko-install
Update disko-install

Co-authored-by: Michael Hoang <Enzime@users.noreply.github.com>
2024-11-22 12:45:57 +01:00
Michon van Dooren
92ad678418
Add examples for all special zpool vdev types 2024-11-18 22:50:10 +01:00
Michon van Dooren
caad548415
Make vdev sort only move empty modes to the start 2024-11-18 22:49:51 +01:00
Michon van Dooren
d192ffd944
Fix zpool create for disk vdev after mirror vdev
A config like

```nix
{
  vdev = [
    {
      mode = "mirror";
      members = [ "data1" "data2" ];
    }
    {
      members = [ "data3" ];
    }
  ];
}
```

would result in the following command:

```shell
zpool create -f <name> mirror /dev/data1 /dev/data2 /dev/data3
```

which would result in a single vdev with a 3-way mirror, rather than a
vdev with a 2-way mirror and a second vdev with a single disk. By
reordering the vdevs to handle those with an empty mode first we
transform this into:

```shell
zpool create -f <name> /dev/data3 mirror /dev/data1 /dev/data2
```

which does have the desired outcome.
2024-11-18 01:33:49 +01:00
Michon van Dooren
6a472cc248
Fix zpool create with > 1 log/dedup/special vdev
The type keyword was included before every vdev:

```shell
zpool create -f <name> /dev/sda log mirror /dev/sdb /dev/sdc log mirror /dev/sdd /dev/sde
```

but this is incorrect and should instead be:

```shell
zpool create -f <name> /dev/sda log mirror /dev/sdb /dev/sdc mirror /dev/sdd /dev/sde
```
2024-11-17 22:19:33 +01:00
Michon van Dooren
9b56c1afdb
Add support for ZFS spare, log & dedup vdevs 2024-11-17 15:52:28 +01:00
Felix Uhl
9f97bd0995 lib: Fix jsonTypes evaluation
This will be very useful for generating documentation.

Backported from a5c646bd93 for #789
2024-11-16 08:21:10 +00:00
DavHau
58cd832497 lvm_vg: fix size=100% leading to crash
lvcreate -l does not accept a '100%' parameter which currently leads to a crash. THis change automatically changes `100%` to `100%FREE` leading to the intended behavior.
2024-10-26 11:42:42 +00:00
Felix Uhl
4be2aadf13 lib: use lib.escapeShellArg for concatenated paths 2024-10-22 09:10:08 +00:00
Felix Uhl
ca47da60e5 disko: fix improper handling of whitespace
Fixes #130

This should fix pretty much all cases where spaces or other special
characters would break disko due to improper quoting. I searched for all
instances of '.label', '.device' and '.name', so I believe I caught
whatever I could.

In some cases I changed single quotes to double quotes for consistency.

I know we don't usually fix bugs in the legacy table type, but it was so
easy I couldn't resist.
2024-10-22 09:10:08 +00:00
Felix Uhl
dcabccaad6 swap: fix partition type
Fixes #391
2024-10-16 17:05:43 +00:00
qbisi
ef408f7f9a options: add imageName option to disk type.
For disk type, option name used in disk partlabel
naming should be short. While setting a specialized
option imageName allow us to create image with long name
without side-effects.
2024-10-14 16:16:13 +00:00
Jörg Thalheim
91cd091669 zpool: fix default value for cache
we want an empty list instead of null
2024-10-01 08:55:41 +02:00
Felix Uhl
72c867c439 Run nix fmt 2024-09-26 15:36:54 +02:00
r-vdp
1f8e67e945
Always add dm-snapshot when LVM is used
The lvm_type is only set on RAID and thinly provisioned LVM volumes, but
regular LVM volumes without a type can also have snapshots.
2024-09-25 09:30:14 +02:00
Jörg Thalheim
6d42596a35 lvm: add missing dm-snapshot
Usually this is added by nixos-generate-config.
However now that we run nixos-generate-config before disko or we even
run nixos-facter, we likely not see the LVM block devices anymore.
2024-09-24 16:53:30 +00:00
Jörg Thalheim
bc7fd7238a filesystem: escape shell args 2024-09-20 14:47:45 +02:00
Michael Hoang
d32d1504c7 zpool: support updating zfsprops on root dataset 2024-09-17 16:35:12 +00:00
Michael Hoang
a9eeea3379 zfs_fs: support updating mountpoint properly
Use `zfs set -u` to update the `mountpoint` flag without mounting or
unmounting the filesystem. This flag was added in OpenZFS 2.2.0, which
was released October 2023.

The previous logic would not update `mountpoint` if `config.options` was
empty or only contained `mountpoint`.
2024-09-17 16:35:12 +00:00
Michael Hoang
cc4d4a4b91 make-disk-image: convert into NixOS module
As `makeDiskImages` always requires a NixOS configuration, we can
simplify the code by convering it into a NixOS module. Then we can make
it responsible for populating `system.build.diskoImages` and
`system.build.diskoImagesScript`.
2024-09-14 19:35:44 +10:00
Jörg Thalheim
8f0f75f1a8 zpool: better error message if zpool has no assigned devices 2024-09-03 17:11:42 +02:00
Jörg Thalheim
37c83c08d1
Merge pull request #723 from dmadisetti/dm/zfs-extra
zfs: add ZFS "topology" features like explicit vdevs, cache, and special
2024-09-03 17:07:39 +02:00
Sergey Kazenyuk
099b6cca33 btrfs: add swap priority, options 2024-09-03 14:06:14 +00:00
Sergey Kazenyuk
39b4091769 swap: add mountOptions 2024-09-03 14:06:14 +00:00
zerox
70a22d25a2 Switch to qcow2 in the interactive VM. 2024-08-31 09:57:41 +05:00
Dylan Madisetti
071306e76a
tidy: apply suggestions from code review
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2024-08-26 14:13:07 -04:00
dylan madisetti
c9d3bc3755
fix: properly apply oneOf 2024-08-26 14:00:44 -04:00
dylan madisetti
ea3ce722ea
zfs: fix test and add documentation 2024-08-26 13:03:25 -04:00
dylan madisetti
cc2e247193
zfs: make topology a mode type 2024-08-26 12:27:04 -04:00
zerox
540cd416f6
zfs: add ability to specify full path of to the disk. 2024-08-26 09:48:53 +05:00
Felix Uhl
435737144b swap: don't create filesystem if randomEncryption is enabled
This is not an issue when initially creating the partition because
device mapper will just map on top of the filesystem, but it breaks
incremental updates because the check for `TYPE=` will fail, and the
subsequent attempt to run `mkswap` also fails:

mkswap: cannot open /dev/disk/by-partlabel/disk-nix-store-swap: Device or resource busy

Instead, just don't do anything, NixOS will take care of it.
2024-08-22 17:59:43 +00:00
Felix Uhl
f6b2e0052d zfs_fs: Fix errors when not changing mountpoint
Running `zfs set mountpoint=/mnt/my-ds tank/my-ds`, ZFS may try to
unmount the dataset even if the mountpoint didn't change.
To avoid the confusing error message, this command is now only run when
the mountpoint actually changes.
2024-08-22 17:50:13 +00:00
lassulus
6433571556
Merge pull request #713 from nix-community/interactiveVM
add interactive VMs
2024-08-21 16:12:23 +02:00
matthewcroughan
cc86fe1a7c f2fs: init 2024-08-20 10:26:29 +01:00
dylan madisetti
8d071db09b
test: fix and add stub test for zfs-with-vdevs 2024-08-05 12:11:35 -04:00
dylan madisetti
6bebcc728e
tidy: move relevant variables and format script block 2024-08-01 15:59:33 -04:00
dylan madisetti
b2a106f8ed
zfs: Add topology attribute to zpool 2024-08-01 15:41:09 -04:00
lassulus
5a9f2498fb luks: add testmode password "disko" 2024-07-21 22:45:12 +02:00
lassulus
6208b31a73 nix fmt 2024-07-21 16:44:30 +02:00
Jörg Thalheim
05f4e223b5 gpt: move boot partitions to the front of disko
Than we no longer need to do this in our examples.

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2024-06-30 07:50:33 +00:00
Jörg Thalheim
115311bc39 zfs: try to import zpool in incremental mode
if the pool is not imported, zfs list will return a value. So to check
that the pool does not exist, we also import it.

fixes https://github.com/nix-community/disko/issues/690
2024-06-28 13:52:20 +00:00
Jörg Thalheim
96cab883db zfs: when dataset already exist, only update dataset options 2024-06-28 13:53:07 +02:00