!oNSIfazDqEcwhcOjSL:matrix.org

disko

367 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko92 Servers

Load older messages


SenderMessageTime
13 Dec 2023
@lassulus:lassul.uslassulusyeah16:16:50
@matthewcroughan:defenestrate.itmatthewcroughan * You mean in gpt.nix as-is?16:16:50
@matthewcroughan:defenestrate.itmatthewcroughan _create and _hybridCreate? 16:16:59
@matthewcroughan:defenestrate.itmatthewcroughan

Here's how _create looks from the hybrid PR:

    _create = diskoLib.mkCreateOption {
      inherit config options;
      default = { dev }: ''
        ${(config.content._create { inherit dev; })}

        sgdisk -h \
          ${lib.concatMapStringsSep ":" (hp: (toString hp.gptPartitionNumber)) config.hybrid_partitions}${lib.optionalString (!config.efiGptPartitionFirst) ":EE"} \
          ${dev}

        ${lib.concatImapStrings (i: hp: hp._create {inherit dev; partNum = i + (if config.efiGptPartitionFirst then 1 else 0 );}) config.hybrid_partitions}
      '';
    };

16:17:58
@lassulus:lassul.uslassulusmaybe just an optionalString in the create, which only runs if any of the partitions has the hybrid flag set (and no more than 3 have it set) and then does the collection of the partitions16:18:36
@matthewcroughan:defenestrate.itmatthewcroughanThis flag is used in startlingly few places https://sourcegraph.com/search?q=context:global+sgdisk+-h&patternType=standard&sm=1&groupBy=repo16:25:32
@matthewcroughan:defenestrate.itmatthewcroughanhttps://gist.github.com/syzdek/ac4bb4ddc9414839474dbea64cdc589716:28:49
@matthewcroughan:defenestrate.itmatthewcroughana good example of using it 16:28:54
@matthewcroughan:defenestrate.itmatthewcroughan * a good example of using it with --hybrid 16:29:01
@matthewcroughan:defenestrate.itmatthewcroughan Ah I see, you're saying to run a second sgdisk command if the partition is marked as hybrid, I was trying to shove it all into one invocation 16:30:27
@lassulus:lassul.uslassulusmaybe it's easier to do in in a postCreateHook first on the table16:32:28
@lassulus:lassul.uslassulusand then make it options afterward16:32:36
@matthewcroughan:defenestrate.itmatthewcroughanYeah, given that this is non-standard is it even a good idea to add it to disko?16:32:45
@lassulus:lassul.uslassulusif it's justa few lines sure16:32:55
@lassulus:lassul.uslassulusif it's significantly more, probably an example would be better16:33:13
@matthewcroughan:defenestrate.itmatthewcroughan hybrid is a hack, and if you use a partitioning tool other than sgdisk on the drive could fsck the disk up 16:33:06
@lassulus:lassul.uslassulusyeah, just do the example route for now16:33:29
@lassulus:lassul.uslassulusand add it as one to the repo, so we can test it16:33:43
@matthewcroughan:defenestrate.itmatthewcroughan so if disko ever migrated away from sgdisk, the aspirations of an updateScript would break drives done this way 16:33:49
@lassulus:lassul.uslassulusnot sure an updateScript can ever touch the parition tables. but yeah :D16:34:19
@matthewcroughan:defenestrate.itmatthewcroughanOh okay, that makes sense then.16:35:06
@matthewcroughan:defenestrate.itmatthewcroughanI'm wondering about the erase-your-darlings setup now, and how you could use disko to repartition/reorganize the drives on each boot, how abusive is that to the drive?16:41:26
@lassulus:lassul.uslassulususually partition tables and partitions are quite small in size. it's the stuff you put on there that makes more writes. so I guess should be fine?16:52:28
@matthewcroughan:defenestrate.itmatthewcroughanBeen having no luck with hybrid mbr stuff and the Pi 18:14:47
@matthewcroughan:defenestrate.itmatthewcroughanA good blog post on it https://www.eisfunke.com/posts/2023/uefi-boot-on-raspberry-pi-3.html18:27:01
@matthewcroughan:defenestrate.itmatthewcroughan

Again, I recommend leaving your fingers off the partitioning now that we’re done. The hybrid MBR in combination with the somewhat finicky RPi bootloader really is quite fragile. For example, at one point in a test run I had the disk flag pmbr_boot shown on the SD card in parted. I guess that stemmed from me setting the bootable flag when hybridizing, I’m not 100% sure. Anyway, I tried to disable it with disk_toggle pmbr_boot in parted, which promptly broke the boot – the UEFI firmware didn’t load anymore, and toggling the flag again didn’t fix it.

18:28:14
@matthewcroughan:defenestrate.itmatthewcroughanamazing18:28:15
@matthewcroughan:defenestrate.itmatthewcroughan lassulus: after the past 3-4 hours of debugging, it turns out that the raspberry pi 3 needs the fat32 partition to be the first partition which is impractical to work around with disko atm 20:27:32
@matthewcroughan:defenestrate.itmatthewcroughanditching gpt is the only sensible way, even with hybrid mbr it's just totally messed up 20:27:50
@matthewcroughan:defenestrate.itmatthewcroughansgdisk --hybrid puts the protective mbr (0xee) as the first partition, but the pi's firmware (bootcode.bin) doesn't like that20:28:58

Show newer messages


Back to Room ListRoom Version: 10