Giter VIP home page Giter VIP logo

Comments (13)

Lassulus avatar Lassulus commented on May 24, 2024

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.

Mic92 avatar Mic92 commented on May 24, 2024

If you are able to detect that, you may want to error out.

from disko.

Lassulus avatar Lassulus commented on May 24, 2024

I will build the easier case first to destroy everything we touch.

from disko.

Lassulus avatar Lassulus commented on May 24, 2024

so I guess this has been taken care of with our excellent jq script

from disko.

iclanzan avatar iclanzan commented on May 24, 2024

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.

Lassulus avatar Lassulus commented on May 24, 2024

what did you run and what was the output of the script?

from disko.

iclanzan avatar iclanzan commented on May 24, 2024

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.

Lassulus avatar Lassulus commented on May 24, 2024

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.

Lassulus avatar Lassulus commented on May 24, 2024

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.

iclanzan avatar iclanzan commented on May 24, 2024

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.

Lassulus avatar Lassulus commented on May 24, 2024

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.

Lassulus avatar Lassulus commented on May 24, 2024

#364

from disko.

iclanzan avatar iclanzan commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.