pin Would you care to describe the details associated with this?
Oh, that's simple enough:
/tmp# gpt show -l wd0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 2014 Unused
2048 614400 1 GPT part - EFI
616448 1228800 2 GPT part - Basic data partition
1845248 262144 3 GPT part - Microsoft reserved partition
2107392 8192 4 GPT part - FreeBSD_EFI
2115584 104857600 7 GPT part - FreeBSD_13.1
106973184 8390656 8 GPT part - FreeBSD_swap
115363840 16384 9 GPT part - NetBSD_EFI
115380224 41943040 10 GPT part - NetBSD_main
157323264 10485760 11 GPT part - NetBSD_swap
167809024 20971520 12 GPT part - Linux_backup
188780544 16384 13 GPT part - OpenBSD_EFI
188796928 62914560 14 GPT part - OpenBSD_7.2
251711488 104857600 15 GPT part - NetBSD_test
356569088 19470336 Unused
376039424 8388608 5 GPT part - Ubuntu_swap
384428032 592343040 6 GPT part - Ubuntu_19.04
976771072 2063 Unused
976773135 32 Sec GPT table
976773167 1 Sec GPT header
/tmp# gpt add -a 1m -l NetBSD_xxx -s 10m wd0
/dev/rwd0: Partition 16 added: 49f48d5a-b10e-11dc-b99b-0019d1879648 356569088 20480
/tmp# gpt show -i 16 wd0
Details for index 16:
Start: 356569088 (170G)
Size: 20480 (10M)
Type: ffs (49f48d5a-b10e-11dc-b99b-0019d1879648)
GUID: 00000000-0000-0000-0000-000000000000
Label: NetBSD_xxx
Attributes: None
/tmp# dkctl wd0 listwedges
/dev/rwd0: 16 wedges:
dk0: EFI, 614400 blocks at 2048, type: msdos
dk1: Basic data partition, 1228800 blocks at 616448, type:
dk2: Microsoft reserved partition, 262144 blocks at 1845248, type:
dk3: FreeBSD_EFI, 8192 blocks at 2107392, type: msdos
dk6: FreeBSD_13.1, 104857600 blocks at 2115584, type: ffs
dk7: FreeBSD_swap, 8390656 blocks at 106973184, type: swap
dk8: NetBSD_EFI, 16384 blocks at 115363840, type: msdos
dk9: NetBSD_main, 41943040 blocks at 115380224, type: ffs
dk10: NetBSD_swap, 10485760 blocks at 157323264, type: swap
dk11: Linux_backup, 20971520 blocks at 167809024, type: ext2fs
dk12: OpenBSD_EFI, 16384 blocks at 188780544, type: msdos
dk13: OpenBSD_7.2, 62914560 blocks at 188796928, type:
dk14: NetBSD_test, 104857600 blocks at 251711488, type: ffs
dk15: NetBSD_xxx, 20480 blocks at 356569088, type: ffs
dk4: Ubuntu_swap, 8388608 blocks at 376039424, type:
dk5: Ubuntu_19.04, 592343040 blocks at 384428032, type: ext2fs
/tmp# dd if=/dev/zero of=/dev/rdk15 bs=1m
dd: /dev/rdk15: end of device
11+0 records in
10+0 records out
10485760 bytes transferred in 0.417 secs (25145707 bytes/sec)
/tmp# gpt remove -L NetBSD_xxx wd0
/dev/rwd0: Partition 16 removed
/tmp# ^D
pin I have to specify a custom path to the .efi file, else it won't boot.
Yeah. Same on mine, but, that's OK--it's a one time setup.
Tell me what you want done and I can post instructions...
pin dd seek
looks rather useful but, you better get your maths right,
Oh yeah! You'll trash some partition if you're off by even a single sector--which is why I avoid this method.
pin Besides, I still need to write it to ... where?
wd0
--the whole disk.
You can't use any other device here because the kernel checks the start/end of any lseek
/read
/write
operations on devices. (Regular files, you can extend by lseek
ing past their last byte and then writing.)
pin [...] will write zeros starting at 7*4096 or, 28672Mb.
Correct, but, to preserve sanity, I prefer to not fiddle with bs=
. The default for bs
is 512
bytes and (logical) sectors on a disk are also the same size, so you can just use some command-line arithmetic for the count=
argument. For example:
dd if=/dev/zero of=/dev/rwd0 oseek=NNNNN count=$(( (10*1024*1024) / 512 ))
That will write 10MB worth of sectors starting at sector no. NNNNN
--which you can take directly from a gpt show
output. (And, writing 10MB 512-blocks at a time is acceptable.)