| 29 Apr 2024 |
Perchun Pak | if I add start = "500G"; to luks, it fails with
+ sgdisk --align-end --new=3:500G:-0 --change-name=3:disk-main-luks --typecode=3:8300 /dev/nvme0n1
Could not create partition 3 from 1048576000 to 1048575999
Unable to set partition 3's name to 'disk-main-luks'!
Could not change partition 3's type code to 8300!
Error encountered; not saving changes.
+ sgdisk --change-name=3:disk-main-luks --typecode=3:8300 /dev/nvme0n1
Unable to set partition 3's name to 'disk-main-luks'!
Could not change partition 3's type code to 8300!
Error encountered; not saving changes.
+ rm -rf /tmp/tmp.STzH236qNq
[nixos@nixos:~/nixos-dotfiles]$
(same error if I set 520gb instead of 500 in luks partition)
| 13:09:23 |
lassulus | Hmm interesting. But not sure why it can't set those things | 13:11:12 |
lassulus | what does fdisk -l show on the device? | 13:11:39 |
Perchun Pak | $ sudo fdisk -l
Disk /dev/loop0: 2.32 GiB, 2491564032 bytes, 4866336 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: WDC PC SN530 SDBPNPZ-1T00-1114
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 49C5265D-9693-4B24-8167-2CC85DF82C4B
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1026047 1024000 500M EFI System
/dev/nvme0n1p2 1048576000 1090519039 41943040 20G Linux filesystem
Disk /dev/sda: 28.91 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB DISK 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9fb6382f
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 0 4989023 4989024 2.4G 0 Empty
/dev/sda2 17780 23923 6144 3M ef EFI (FAT-12/16/32)
/dev/sda3 4997120 60628991 55631872 26.5G 83 Linux
| 13:12:10 |
Perchun Pak | or you mean when it places swap after luks? | 13:12:38 |
Perchun Pak | Disk /dev/loop0: 2.32 GiB, 2491564032 bytes, 4866336 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: WDC PC SN530 SDBPNPZ-1T00-1114
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BE5D969-68F3-4616-89B4-4942C37C2E9F
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1026047 1024000 500M EFI System
/dev/nvme0n1p2 1048576000 1090519039 41943040 20G Linux filesystem
/dev/nvme0n1p3 1026048 1048575999 1047549952 499.5G Linux filesystem
Partition table entries are not in disk order.
Disk /dev/sda: 28.91 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB DISK 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9fb6382f
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 0 4989023 4989024 2.4G 0 Empty
/dev/sda2 17780 23923 6144 3M ef EFI (FAT-12/16/32)
/dev/sda3 4997120 60628991 55631872 26.5G 83 Linux
Disk /dev/mapper/encrypted: 499.5 GiB, 536328798208 bytes, 1047517184 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/root_vg-root: 499.49 GiB, 536325652480 bytes, 1047511040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
| 13:49:44 |
| NixOS Moderation Botchanged room power levels. | 15:28:20 |
| comm0n changed their display name from common to comm0n. | 19:51:46 |
| mfed3 joined the room. | 23:47:57 |
| 30 Apr 2024 |
| ondt joined the room. | 22:24:22 |
| 1 May 2024 |
| NixOS Moderation Botchanged room power levels. | 15:05:56 |
| 3 May 2024 |
| hxr404 ✨ [it/she] changed their display name from hxr404 ✨ [they/them] to hxr404 ✨ [it/she]. | 10:18:23 |
| Infinidoge joined the room. | 19:21:13 |
| 6 May 2024 |
Perchun Pak | In reply to @lassulus:lassul.us Hmm interesting. But not sure why it can't set those things have you had some free time to look at it? it is kind of blocking for me | 11:22:52 |
lassulus | oh it's a dos partition table | 11:23:23 |
lassulus | well, then you have to use the legacy table type | 11:23:39 |
lassulus | and live with the warning | 11:23:46 |
lassulus | or is that the stick? | 11:24:09 |
lassulus | ah it's the stick, nvm | 11:24:25 |
Perchun Pak | windows works only on a legacy table? | 11:24:44 |
lassulus | windows can also do gpt | 11:24:52 |
Perchun Pak | great, then I don't have to live with the warning | 11:25:07 |
lassulus | so, just to recap, what do you want to achieve? | 11:26:46 |
Perchun Pak | In reply to @perchun:matrix.org sent an image. I want to create 500gb gap between boot partition and swap+linux partitions | 11:27:23 |
lassulus | esp = { ... };
swap = {
start = "500G";
end = "520G";
# ...
};
luks = {
start = "520G";
size = "100%";
# ...
};
| 11:35:27 |
lassulus | does that work? | 11:36:23 |
Perchun Pak | umount: /mnt: not mounted
++ realpath /dev/nvme0n1
+ disk=/dev/nvme0n1
+ lsblk -a -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0 squashfs 4.0 0 100% /nix/.ro-store
loop1
loop2
loop3
loop4
loop5
loop6
loop7
sda iso9660 Joliet Extension nixos-gnome-23.11-x86_64 1980-01-01-00-00-00-00
├─sda1 iso9660 Joliet Extension nixos-gnome-23.11-x86_64 1980-01-01-00-00-00-00 0 100% /iso
├─sda2 vfat FAT12 EFIBOOT 1234-5678
└─sda3 ext4 1.0 66a36068-3586-4f20-86ec-9daed69e64ad 23G 6% /run/media/nixos/66a36068-3586-4f20-86ec-9daed69e64ad
nvme0n1
├─nvme0n1p1 vfat FAT16 5145-4BD6
├─nvme0n1p2 swap 1 f7129bc1-ba4f-4547-8818-c902b810fea7
└─nvme0n1p3 crypto_LUKS 2 9bffc650-5396-41d6-abac-8085e22d2464
+ lsblk --output-all --json
+ bash -x
++ dirname /nix/store/g4czfcchgscykz006bnv1ncazkb6jzdp-disk-deactivate/disk-deactivate
+ jq -r --arg disk_to_clear /dev/nvme0n1 -f /nix/store/g4czfcchgscykz006bnv1ncazkb6jzdp-disk-deactivate/disk-deactivate.jq
+ set -fu
+ wipefs --all -f /dev/nvme0n1p1
/dev/nvme0n1p1: 8 bytes were erased at offset 0x00000036 (vfat): 46 41 54 31 36 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
+ swapoff /dev/nvme0n1p2
swapoff: /dev/nvme0n1p2: swapoff failed: Invalid argument
+ wipefs --all -f /dev/nvme0n1p2
/dev/nvme0n1p2: 10 bytes were erased at offset 0x00000ff6 (swap): 53 57 41 50 53 50 41 43 45 32
+ wipefs --all -f /dev/nvme0n1p3
/dev/nvme0n1p3: 6 bytes were erased at offset 0x00000000 (crypto_LUKS): 4c 55 4b 53 ba be
/dev/nvme0n1p3: 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'
+ zpool=
+ [[ -n '' ]]
+ unset zpool
++ lsblk /dev/nvme0n1 -l -p -o type,name
++ awk 'match($1,"raid.*") {print $2}'
+ md_dev=
+ [[ -n '' ]]
+ 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 0xee77a55e00 (gpt): 45 46 49 20 50 41 52 54
/dev/nvme0n1: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
+ dd if=/dev/zero of=/dev/nvme0n1 bs=440 count=1
1+0 records in
1+0 records out
440 bytes copied, 0.000150011 s, 2.9 MB/s
+ lsblk -a -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0 squashfs 4.0 0 100% /nix/.ro-store
loop1
loop2
loop3
loop4
loop5
loop6
loop7
sda iso9660 Joliet Extension nixos-gnome-23.11-x86_64 1980-01-01-00-00-00-00
├─sda1 iso9660 Joliet Extension nixos-gnome-23.11-x86_64 1980-01-01-00-00-00-00 0 100% /iso
├─sda2 vfat FAT12 EFIBOOT 1234-5678
└─sda3 ext4 1.0 66a36068-3586-4f20-86ec-9daed69e64ad 23G 6% /run/media/nixos/66a36068-3586-4f20-86ec-9daed69e64ad
nvme0n1
++ mktemp -d
+ disko_devices_dir=/tmp/tmp.d2IeamxpkX
+ trap 'rm -rf "$disko_devices_dir"' EXIT
+ mkdir -p /tmp/tmp.d2IeamxpkX
+ device=/dev/nvme0n1
+ imageSize=2G
+ name=main
+ type=disk
+ device=/dev/nvme0n1
+ efiGptPartitionFirst=1
+ type=gpt
+ blkid /dev/nvme0n1
+ sgdisk --clear /dev/nvme0n1
Creating new GPT entries in memory.
The operation has completed successfully.
+ sgdisk --align-end --new=1:0:+500M --change-name=1:disk-main-ESP --typecode=1:EF00 /dev/nvme0n1
The operation has completed successfully.
+ partprobe /dev/nvme0n1
+ udevadm trigger --subsystem-match=block
+ udevadm settle
+ sgdisk --align-end --new=2:500G:520G --change-name=2:disk-main-swap --typecode=2:8300 /dev/nvme0n1
The operation has completed successfully.
+ partprobe /dev/nvme0n1
+ udevadm trigger --subsystem-match=block
+ udevadm settle
+ sgdisk --align-end --new=3:520G:-0 --change-name=3:disk-main-luks --typecode=3:8300 /dev/nvme0n1
Could not create partition 3 from 1090519040 to 1048575999
Unable to set partition 3's name to 'disk-main-luks'!
Could not change partition 3's type code to 8300!
Error encountered; not saving changes.
+ sgdisk --change-name=3:disk-main-luks --typecode=3:8300 /dev/nvme0n1
Unable to set partition 3's name to 'disk-main-luks'!
Could not change partition 3's type code to 8300!
Error encountered; not saving changes.
+ rm -rf /tmp/tmp.d2IeamxpkX
| 11:38:23 |
Perchun Pak |  Download image.png | 11:38:59 |
lassulus | hmm, I wonder if sgdisk can do 250G + 1 or something :D | 11:55:45 |
lassulus | * hmm, I wonder if sgdisk can do 520G + 1 or something :D | 11:55:54 |