On Thu, Apr 23, 2020 at 04:42:53PM -0400, Allan Streib wrote:
> > So, can I setup openBSD labels on x86_64 without legacy/GPT partition
> > first ?
>
> IIRC yes you can, as long as you don't need to boot from that disk.
Easily confirmed (a few false starts deleted from this transcript):
$ uname -a
OpenBSD foo.darwinsys.com 6.7 GENERIC.MP#145 amd64
# Here I plugged in a cheap USB device
$ dmesg | tail -4
umass0: using SCSI over Bulk-Only
scsibus4 at umass0: 2 targets, initiator 0
sd2 at scsibus4 targ 1 lun 0: <Verbatim, Store n Go Drive, > removable
serial.18a50238052700000130
sd2: 3750MB, 512 bytes/sector, 7680000 sectors
# Trash any existing fdisk and disklabel info
# dd if=/dev/random of=/dev/rsd2c bs=512 count=100
100+0 records in
100+0 records out
51200 bytes transferred in 0.068 secs (742845 bytes/sec)
# disklabel sd2
# /dev/rsd2c:
type: SCSI
disk: SCSI disk
label: Store n Go Drive
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 478
total sectors: 7680000
boundstart: 0
boundend: 7680000
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg]
c: 7680000 0 unused
i: 7679944 56 MSDOS
# fdisk sd2 # confirm there is no fdisk table, just random rubbish
Disk: sd2 geometry: 478/255/63 [7680000 Sectors]
Offset: 0 Signature: 0x111
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
0: 82 77157 27 55 - 172421 98 24 [ 1239528960: 1530420603 ] Linux swap
1: 64 10096 3 23 - 176047 141 26 [ 162192451: 2666011513 ] NetWare 2.xx
2: 6E 252409 74 42 - 209458 117 56 [ 4054955288: 3604962205 ] <Unknown ID>
3: A9 19978 12 42 - 22375 228 62 [ 320947367: 38521434 ] NetBSD
# disklabel -E sd2
Label editor (enter '?' for help at any prompt)
sd2> p
OpenBSD area: 0-7680000; size: 7680000; free: 7680000
# size offset fstype [fsize bsize cpg]
c: 7680000 0 unused
sd2> a
partition: [a]
offset: [0] 64
size: [7679936] 100M
FS type: [4.2BSD]
sd2*> w
sd2> q
No label changes.
# newfs /dev/rsd2a
/dev/rsd2a: 101.9MB in 208768 sectors of 512 bytes
4 cylinder groups of 25.48MB, 1631 blocks, 3328 inodes each
super-block backups (for fsck -b #) at:
32, 52224, 104416, 156608,
# mount /dev/sd2a /mnt
$ ls /mnt
$ date | doas dd of=/mnt/date.txt
0+1 records in
0+1 records out
29 bytes transferred in 0.000 secs (322584 bytes/sec)
$ ls /mnt
date.txt
$ cat /mnt/date.txt
Thu Apr 23 18:55:35 EDT 2020
# fdisk sd2 # still no fdisk table
Disk: sd2 geometry: 478/255/63 [7680000 Sectors]
Offset: 0 Signature: 0x111
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
0: 82 77157 27 55 - 172421 98 24 [ 1239528960: 1530420603 ] Linux swap
1: 64 10096 3 23 - 176047 141 26 [ 162192451: 2666011513 ] NetWare 2.xx
2: 6E 252409 74 42 - 209458 117 56 [ 4054955288: 3604962205 ] <Unknown ID>
3: A9 19978 12 42 - 22375 228 62 [ 320947367: 38521434 ] NetBSD
#
So: I was able to newfs, mount, and use an OpenBSD partition which
disklabel called 'a' and which had no trace of an fdisk partition around it.
As Allan pointed out, this is not for booting from - none of those
fdisk partitions looks very healthy.