freebsd-skq/sys/geom
eugen 22eefa8b94 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
..
bde geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
cache geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
concat geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
eli We don't need the sc_ekeys_lock in standalone environment. 2020-09-14 23:51:14 +00:00
gate geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
journal sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/". 2020-07-09 02:52:39 +00:00
label geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
linux_lvm Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
mirror geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
mountver geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
multipath geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
nop geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
part geom_part: make it possible recovering broken GPT after some LBAs cut off 2020-09-17 04:39:39 +00:00
raid geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
raid3 geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
shsec Use explicit_bzero() instead of bzero() for sensitive data. 2020-06-25 20:25:35 +00:00
stripe Consistently use gctl_get_provider instead of home-grown variants. 2020-07-22 02:15:21 +00:00
uzip geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
vinum geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
virstor geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
zero geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_bsd_enc.c sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom_ccd.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_ctl.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_ctl.h Define a constant for the maximum number of GEOM_CTL arguments. 2019-02-20 17:07:08 +00:00
geom_dbg.h GEOM: Reduce unnecessary log interleaving with sbufs 2019-08-07 19:28:35 +00:00
geom_dev.c Retire devctl_notify_f() 2020-08-29 04:30:06 +00:00
geom_disk.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_disk.h Add GEOM attribute to report physical device name, and report it 2019-11-09 17:30:19 +00:00
geom_dump.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_event.c Move TDP_GEOM check from userret() to ast(); this code path is quite 2020-09-14 10:14:03 +00:00
geom_flashmap.c Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
geom_flashmap.h geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_int.h Remove duplicate g_debugflags declaration. 2019-12-05 15:07:32 +00:00
geom_io.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_kern.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_map.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_redboot.c geom_map and geom_redboot: Remove unused ctlreq handler. 2020-07-26 22:30:01 +00:00
geom_slice.c Pass BIO_SPEEDUP through all the geom layers 2020-01-17 01:15:55 +00:00
geom_slice.h sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom_subr.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_vfs.c This commit enables a UFS filesystem to do a forcible unmount when 2020-05-25 23:47:31 +00:00
geom_vfs.h sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom.h gctl_get_geom: Skip validation of g_class. 2020-07-26 22:30:55 +00:00
notes