mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-12 08:00:05 +01:00
zap: destroy all mdadm devices if mdadm is in PATH
This commit is contained in:
parent
e0ce5fb75f
commit
66add2cd9e
2 changed files with 8 additions and 5 deletions
|
|
@ -114,7 +114,7 @@ $ nix-channel --update
|
||||||
|
|
||||||
``` nix
|
``` nix
|
||||||
{
|
{
|
||||||
imports = [ "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/main.tar.gz"}/modules/disko.nix" ];
|
imports = [ "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix" ];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ rec {
|
||||||
# ensures that "/" is processed before "/foo" etc.
|
# ensures that "/" is processed before "/foo" etc.
|
||||||
${concatStrings (attrValues fsMounts)}
|
${concatStrings (attrValues fsMounts)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
/* takes a disko device specification and returns a string which unmounts, destroys all disks and then runs create and mount
|
/* takes a disko device specification and returns a string which unmounts, destroys all disks and then runs create and mount
|
||||||
|
|
||||||
zapCreateMount :: types.devices -> str
|
zapCreateMount :: types.devices -> str
|
||||||
|
|
@ -164,10 +165,12 @@ rec {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# stop all existing raids
|
# stop all existing raids
|
||||||
|
if command -v mdadm; then
|
||||||
for r in /dev/md/* /dev/md[0-9]*; do
|
for r in /dev/md/* /dev/md[0-9]*; do
|
||||||
# might fail if the device was already closed in the loop
|
# might fail if the device was already closed in the loop
|
||||||
mdadm --stop "$r" || true
|
mdadm --stop "$r" || true
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo 'creating partitions...'
|
echo 'creating partitions...'
|
||||||
${diskoLib.create devices}
|
${diskoLib.create devices}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue