Comments (13)
I'm working now on a destroy function in the types.nix. so we can zap only the devices we actually care about.
a question though. If our specification wants to zap a disk from, for example, a raid. but not the other one. should we destroy the whole raid, leave it broken or abort?
from disko.
If you are able to detect that, you may want to error out.
from disko.
I will build the easier case first to destroy everything we touch.
from disko.
so I guess this has been taken care of with our excellent jq script
from disko.
Ran into this issue today using the most recent master commits of disko
and nixos-anywhere
:
- First attempt failed to complete successfully because of a misconfiguration on my part.
- After fixing my issue, failed with "No such file or directory" when the scripts attempted to access partitions
- After using
blkdiscard
the script ran successfully
from disko.
what did you run and what was the output of the script?
from disko.
Here’s the config:
{
disk.main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
nix = {
size = "100%";
content = {
type = "luks";
name = "crypted";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
};
};
};
};
};
};
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=2G"
"mode=755"
];
};
};
}
And here is the output:
### Formatting hard drive with disko ###
umount: /mnt: not mounted
++ realpath /dev/nvme0n1
+ disk=/dev/nvme0n1
+ lsblk -a -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1
├─nvme0n1p1 vfat FAT32 A1A9-070D
└─nvme0n1p2 crypto_LUKS 2 1bd9223e-ecec-41ca-9c0d-4f62be902c58
└─crypted ext4 1.0 059b3610-2112-406f-abea-bcf642691748
+ lsblk --output-all --json
+ bash -x
++ dirname /nix/store/6spz196jy5yx9dxm0dvj2n0girb4r97i-disk-deactivate/disk-deactivate
+ jq -r --arg disk_to_clear /dev/nvme0n1 -f /nix/store/6spz196jy5yx9dxm0dvj2n0girb4r97i-disk-deactivate/d
isk-deactivate.jq
+ set -fu
+ wipefs --all -f /dev/nvme0n1p1
/dev/nvme0n1p1: 8 bytes were erased at offset 0x00000052 (vfat): 46 41 54 33 32 20 20 20
/dev/nvme0n1p1: 1 byte was erased at offset 0x00000000 (vfat): eb
/dev/nvme0n1p1: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa
+ cryptsetup luksClose /dev/mapper/crypted
+ wipefs --all -f /dev/mapper/crypted
wipefs: error: /dev/mapper/crypted: probing initialization failed: No such file or directory
+ wipefs --all -f /dev/nvme0n1p2
/dev/nvme0n1p2: 6 bytes were erased at offset 0x00000000 (crypto_LUKS): 4c 55 4b 53 ba be
/dev/nvme0n1p2: 6 bytes were erased at offset 0x00004000 (crypto_LUKS): 53 4b 55 4c ba be
++ zdb -l /dev/nvme0n1
++ sed -nr 's/ +name: '\''(.*)'\''/\1/p'
bash: line 6: zdb: command not found
+ zpool=
+ [[ -n '' ]]
+ unset zpool
+ wipefs --all -f /dev/nvme0n1
/dev/nvme0n1: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/nvme0n1: 8 bytes were erased at offset 0x1d1c1115e00 (gpt): 45 46 49 20 50 41 52 54
/dev/nvme0n1: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
+ lsblk -a -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1
++ mktemp -d
+ disko_devices_dir=/tmp/tmp.UmEoNhizMl
+ trap 'rm -rf "$disko_devices_dir"' EXIT
+ mkdir -p /tmp/tmp.UmEoNhizMl
+ device=/dev/nvme0n1
+ imageSize=2G
+ name=main
+ type=disk
+ device=/dev/nvme0n1
+ type=gpt
+ sgdisk --new=1:0:+512M --change-name=1:disk-main-ESP --typecode=1:EF00 /dev/nvme0n1
Creating new GPT entries in memory.
The operation has completed successfully.
+ udevadm trigger --subsystem-match=block
+ udevadm settle
+ partprobe
+ device=/dev/disk/by-partlabel/disk-main-ESP
+ extraArgs=()
+ declare -a extraArgs
+ format=vfat
+ mountOptions=('defaults')
+ declare -a mountOptions
+ mountpoint=/boot
+ type=filesystem
+ mkfs.vfat /dev/disk/by-partlabel/disk-main-ESP
mkfs.fat 4.2 (2021-01-31)
mkfs.vfat: unable to open /dev/disk/by-partlabel/disk-main-ESP: No such file or directory
+ rm -rf /tmp/tmp.UmEoNhizMl
Side note: I am surprised to see ZFS commands in there when ZFS is not involved in any way on either the source or target machine.
from disko.
hmm, seems like udev is not running or failed to create the device nodes in /dev/disk/by-partlabel. can you check if there are other device nodes in there?
from disko.
also this issue seems separate from the one mentioned here. I would suggest opening a new one so I don't forget about it :)
from disko.
Immediately after the failure I did a ls /dev/disk/by-partlabel/disk-main-ESP
and it did exist and was linking to the correct device. So maybe it was created shortly after the script tried to use it.
from disko.
I have a theory what it could be, I will create a PR and it would be nice if you could test that one if isn't a big hassle :)
from disko.
from disko.
I tried but couldn’t repro my issue any more. But of course the state of the disk was no longer what it was when I ran into the issue (brand new nvme).
from disko.
Related Issues (20)
- "Inappropriate ioctl for device" running zpool create
- An error occurs when there are no mountable datasets in the zpool. HOT 2
- Bcachefs multi disk support HOT 2
- label use partlabel instead of label HOT 4
- Disko bcachefs install error HOT 2
- btrfs creating snapshot of root beetween _create and _mount HOT 2
- Questions: ZFS encyption / swap size automation HOT 1
- Cannot specify a relative flake path (flake reference '.' is not an absolute path)
- Support for day 2 operations like resizing HOT 1
- How do I actually create a zfs pool on a running system? HOT 2
- security hole /boot and /boot/loader/random-seed HOT 3
- Wrong type for an EFI System Partition (ESP) HOT 4
- Importing disko from inputs in the same file than the disk configuration throw an error HOT 5
- Ignore Partitions
- Disko v1.3.0 requires a `./` for the disko file and gives a cryptic error when missing
- [feature-request] mode to output fileSystems nix configuration HOT 4
- [example-request] btrfs and bcachefs raids without lvm/mdam
- Using disko to generate raspberry pi sd card images
- Random boot failues due to partition confusion because disko now relies on `by-partlabel` HOT 8
- ZFS Features Support: Dataset property inheritance HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disko.