kernel/rman: Fix error return in sysctl_rman().
Matt changed the error handling in 869748ea0626d3966a0b0e1a8223de70ef05
but forgot to return 'error' from now on.
This fixes devinfo -r (show hardware resource information).
fdisk(8): Silence "invalid fdisk partition table" warning
When we're initializing the disk (i.e., with -i or -I flag), silence the
"invalid fdisk partition table found" warning.
gpt(8): Fix "create" on MBR-formatted disk without free space at end
When to invoke "create" on MBR-formatted disk without free space at the
end, gpt(8) would fail with error of "no room for the backup header";
e.g.,
$ sudo gpt show vn5
Disk vn5: 1024MB (2097152 512-byte sectors)
Start Sectors Size Index Contents
0 1 512B - MBR
1 31 15.5KB - Unused
32 2097120 1024MB 0 MBR part 108 (active)
$ sudo gpt -vvv create -f vn5
gpt create: vn5: mediasize=1073741824; sectorsize=512; blocks=2097152
gpt create: vn5: MBR at sector 0
gpt create: vn5: MBR part: type=108, start=32, size=2097120
gpt create: vn5: error: no room for the backup header
[2 lines not shown]
gpt(8): Support migration of DragonFly (0x6C) slice and disklabel64
Since DragonFly used 386BSD (0xA5) slice in the past, we need to perform
the same migration logic for 386BSD (0xA5) and DragonFly (0x6C) slices.
Detect both disklabel64 and disklabel32 and migrate the partitions.
gpt(8): Read secondary GPT from position stored in the primary header
When the primary GPT is found, read the secondary GPT from the position
stored in the primary header, rather than assuming the end of the disk.
Meanwhile, add error messages for gpt_read() failures.
Obtained-from: NetBSD
gpt(8): Improve "migrate" command in handling unknown partitions
If '-f' (force) is unspecified, exit with an error instead of ignoring
the unknown slice partitions, similar to the handling of unknown DOS
partitions.
gpt(8): Skip GPT header probe when MBR is present
gpt_open() previously probed the GPT header even when an MBR was
present. When opening a disk that had been initialized with
"fdisk -I" (converting it from GPT to MBR), this caused errors in
map_add(), as shown:
% sudo ./gpt -vv show da8
gpt show: da8: mediasize=180045766656; sectorsize=512; blocks=351651888
gpt show: da8: MBR at sector 0
gpt show: da8: Primary GPT at sector 1
gpt show: error: map entry doesn't fit media: new_start + new_size < start + size (34 + 29 < 40 + 409600)
gpt show: unable to open device 'da8': Undefined error: 0
After this change, gpt(8) correctly treats the disk as MBR-only and
displays the partition table:
% sudo ./gpt -vv show da8
gpt show: da8: mediasize=180045766656; sectorsize=512; blocks=351651888
[7 lines not shown]
gpt(8): Improve GPT table partitions reading logic
The old code only tried to read the secondary GPT header, but didn't try
to read the partitions from the secondary GPT table. The updated code
will try that so it could work in the case when there is no the primary
GPT but the secondary GPT.
gpt(8): Improve migrate_disklabel32() to support more filesystems
- Add support for CCD, HAMMER, and HAMMER2 filesystems.
- Use DragonFly's UUIDs for the filesystems instead of FreeBSD's,
because we were using DOSPTYP_386BSD (0xA5) before migrating to
our own DOSPTYP_DFLYBSD (0x6C).
The next commit will add disklabel64 migration support.
gpt(8): Refactor migrate_disklabel() to prepare disklabel64 support
- Refactor migrate_disklabel() into read_disklabel32() and
migrate_disklabel32(). This allows us for easier adding disklabel64
support.
- Free the gpt_read() returned buffer after use.
- Add a comment explaining the 'rowofs' determination.
gpt(8): Print a warning message when gpt_write() fails
gpt_write() is used in many places and all of them don't handle the
writing failure, so update gpt_write() to print a warning message when
it fails.