Namaste misc,

Introduction:
While using the "-R" option with disklabel(8), in a specific case, the
target disk may not match the source disk label parameters.

More precisely, the target disk's boundend may not match with the source
disk.

Overview:
A disk with storage greater than 2 TB and 512 bytes/sector.
Exclusively for use with OpenBSD.
Disk fdisk'ed with MBR and then disklabel'ed to extend the boundaries
beyond the 2 TB, as helpfully described by Crystal Kolipe [1].
Disk label stored.
Disk label (emulated/simulated) corruption.
Disk label restored with disklabel -R, using the original disk label.

Problem:
The restored disk will have the boundend at 2 TB, instead of the source
disk's full disk size boundend.

Detailed steps to reproduce:
On a non-essential ok-if-trashed disk with greater than 2 TB storage and
512 bytes/sector, which is attached as /dev/sdX:
-> Wipe out the previous content (not sure if this is the best way to do
this)
# dd if=/dev/zero of=/dev/sdX bs=1M count=10
-> Create device
# cd /dev
# sh MAKEDEV sdX
-> Create MBR
# fdisk -iy sdX
-> Adjust the boundaries to fill the whole disk.
# disklabel -E sdX
Label editor (enter '?' for help at any prompt)
sdX> b
Starting sector: [64]
Size ('*' for entire disk): [4294961621] *
sdX*> w
sdX> q
No label changes.
-> Store the disk label
# disklabel sdX > layout
-> Wipe out the previous content (not sure if this is the best way to do
this)
# dd if=/dev/zero of=/dev/sdX bs=1M count=10
-> Create MBR
# fdisk -iy sdX
-> Restore the disk label
# disklabel -R sdX layout
-> Store the disk label
# disklabel sdX > layoutrestored

On inspection, the boundend parameter for layout and layoutrestored are
different.

The net effect may be that the restored disk has not had its boundary
extended beyond the fdisk limit of 2 TB.

Acknowledgement:
Koti Koti Dhanyavaad to Crystal for her mail pointing out that MBR can
be used for disks greater than 2 TB, when used exclusively with OpenBSD.

>From a cursory internet search, it seems that this information was part
of the FAQ earlier [2].

However, I did not know this, and I was very pleasantly surprised.

Since GPT takes up one partition, and there are only 16 to work with, I
am now going from GPT to MBR, to use that extra partition.

And also because I do not understand GPT. Not that I understand MBR
much, but anyways. May be next Janm.

Dhanyavaad,
Artha Dharma Kama Moksha

[1] - https://marc.info/?l=openbsd-misc&m=167060793529661
[2] - https://daemonforums.org/showthread.php?t=10116#post60708

Reply via email to