freebsd-nq/sys
Eugene Grosbein b2b5d4c07d geom_part: make it possible recovering broken GPT after some LBAs cut off
This is followup to r365477.

If pre-formatted device has GPT and a partition covering
last available LBAs and the device is attached using
a bridge reducing amount of LBAs, then it could be not enough
forcing GEOM to use primary GPT. Also, we should make it possible
to recover GPT and this requires either deleting or resizing the partition.

This change enables "gpart delete" and "gpart resize" commands
on corrupted GPT with following "gpart recover".

It still does not allow modifying corrupted GPT without
preliminary setting sysctl kern.geom.part.check_integrity=0

For example:

# gpart show da0
=>        34  3906963389  da0  GPT  (1.8T) [CORRUPT]
          34      262144    1  ms-reserved  (128M)
      262178        2014       - free -  (1.0M)
      264192  3906764943    2  freebsd-swap  (1.8T)
# gpart resize -i 2 -s 3900000000 da0
# gpart recover da0

Reported by:	Alex Korchmar
MFC after:	3 days
2020-09-17 04:39:39 +00:00
..
amd64 bhyve: do not permit write access to VMCB / VMCS 2020-09-15 21:04:27 +00:00
arm Move SV_ABI_ERRNO translation into linux-specific code, to simplify 2020-09-15 16:41:21 +00:00
arm64 Move SV_ABI_ERRNO translation into linux-specific code, to simplify 2020-09-15 16:41:21 +00:00
bsm bsm: add AUE_CLOSERANGE 2020-04-24 01:27:25 +00:00
cam mmc_da: universally use uint8_t for the partition index 2020-09-08 06:19:23 +00:00
cddl dtrace: fix fbt return probes on RISC-V 2020-09-11 09:15:49 +00:00
compat Add emulation support for the Linux kcov(4) ioctl API. 2020-09-04 00:12:28 +00:00
conf Move PLTs to the beginning of amd64 kernel modules. 2020-09-16 13:51:47 +00:00
contrib Do not copy vp into f_data for DTYPE_VNODE files. 2020-09-15 21:55:21 +00:00
crypto Don't return errors from the cryptodev_process() method. 2020-09-08 22:41:35 +00:00
ddb ddb: clean up empty lines in .c and .h files 2020-09-01 22:14:30 +00:00
dev e1000: Properly retain promisc flag 2020-09-15 21:07:30 +00:00
dts Remove licenses 2020-06-04 17:20:58 +00:00
fs tmpfs: restore atime updates for reads from page cache. 2020-09-16 21:28:18 +00:00
gdb gdb(4): Support empty qSupported queries 2020-08-18 20:59:10 +00:00
geom geom_part: make it possible recovering broken GPT after some LBAs cut off 2020-09-17 04:39:39 +00:00
gnu Import DTS files for arm, arm64, riscv from Linux 5.8 2020-08-04 19:44:43 +00:00
i386 Move SV_ABI_ERRNO translation into linux-specific code, to simplify 2020-09-15 16:41:21 +00:00
isa
kern Put calls to check_pgrp_jobc() in fixjobc_kill() under INVARIANTS. 2020-09-17 00:07:15 +00:00
kgssapi kgssapi: clean up empty lines in .c and .h files 2020-09-01 22:15:02 +00:00
libkern arm64: check for CRC32 support via HWCAP 2020-09-08 15:39:19 +00:00
mips Refine the busdma template interface. Provide tools for filling in fields 2020-09-14 05:58:12 +00:00
modules [PowerPC64LE] Ensure nvram is built on powerpc64le. 2020-09-13 18:24:15 +00:00
net if_media: definitions for 40GE LM4 ethernet media type 2020-09-16 14:45:16 +00:00
net80211 net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netgraph ng_ether: Enter NET_EPOCH where required 2020-09-02 11:49:22 +00:00
netinet Export the name of the congestion control. This will be used by sockstat 2020-09-13 09:06:50 +00:00
netinet6 net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netipsec net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netpfil net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netsmb net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
nfs nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsclient nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsserver nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nlm nlm: clean up empty lines in .c and .h files 2020-09-01 22:14:52 +00:00
ofed infiniband: Appease Coverty 2020-08-31 16:17:28 +00:00
opencrypto Include sys/types.h here 2020-09-15 15:21:29 +00:00
powerpc [PowerPC64LE] Use correct in_masks table on LE to fix checksumming 2020-09-15 20:47:33 +00:00
riscv Refine the busdma template interface. Provide tools for filling in fields 2020-09-14 05:58:12 +00:00
rpc Fix a potential memory leak in the NFS over TLS handling code. 2020-09-05 00:50:52 +00:00
security mac_framework.h: fix build with DEBUG_VFS_LOCKS and !MAC 2020-09-03 20:30:52 +00:00
sys Use standard bool type, instead of non-standard boolean_t 2020-09-16 06:02:30 +00:00
teken
tests Add small tool to invoke kernel test framework tests. 2020-09-02 09:20:40 +00:00
tools makesyscalls.lua: improve syscall ordering validation 2020-08-04 21:49:13 +00:00
ufs Convert page cache read to VOP. 2020-09-15 22:06:36 +00:00
vm Support for userspace non-transparent superpages (largepages). 2020-09-09 22:12:51 +00:00
x86 Refine the busdma template interface. Provide tools for filling in fields 2020-09-14 05:58:12 +00:00
xdr xdr: clean up empty lines in .c and .h files 2020-09-01 22:13:28 +00:00
xen xen: clean up empty lines in .c and .h files 2020-09-01 21:21:55 +00:00
Makefile