Page MenuHomeFreeBSD

Add the capability to refresh the gpart label without need a reboot.
ClosedPublic

Authored by araujo on Mar 10 2017, 2:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 4:49 AM
Unknown Object (File)
Nov 12 2023, 1:46 PM
Unknown Object (File)
Nov 9 2023, 9:51 PM
Unknown Object (File)
Nov 9 2023, 5:38 PM
Unknown Object (File)
Nov 7 2023, 9:50 PM
Unknown Object (File)
Oct 24 2023, 3:05 AM
Unknown Object (File)
Sep 6 2023, 9:18 AM
Unknown Object (File)
Sep 6 2023, 9:18 AM

Details

Summary

gpart has functionality to change the label of a (GPT) partition. This functionality works like it should, however, after a label change the /dev/gpt/ entries remain unchanged. glabel status output remains unchanged. The change only takes effect after a reboot.

The device was not in use or otherwise 'locked', gpart list shows the new label, but otherwise it appears that the gpart modify -l command does not actually change the device entries, as is expected and desired.

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=162690

Test Plan
root@pipoca:/usr/src/sbin/geom/class/label # gpart list md1
Geom name: md1
modified: false
state: OK
fwheads: 64
fwsectors: 63
last: 2097111
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: md1p1
   Mediasize: 1071644672 (1.0G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 1048576
   Mode: r0w0e0
   rawuuid: 6729280a-0537-11e7-b64d-68f7285fdb52
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: newtest
   length: 1071644672
   offset: 1048576
   type: freebsd-zfs
   index: 1
   end: 2095103
   start: 2048
Consumers:
1. Name: md1
   Mediasize: 1073741824 (1.0G)
   Sectorsize: 512
   Mode: r0w0e0

root@pipoca:/usr/src/sbin/geom/class/label # gpart modify -i 1 -l asiabsdcon md1
md1p1 modified

root@pipoca:/usr/src/sbin/geom/class/label # gpart list md1
Geom name: md1
modified: false
state: OK
fwheads: 64
fwsectors: 63
last: 2097111
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: md1p1
   Mediasize: 1071644672 (1.0G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 1048576
   Mode: r0w0e0
   rawuuid: 6729280a-0537-11e7-b64d-68f7285fdb52
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: asiabsdcon
   length: 1071644672
   offset: 1048576
   type: freebsd-zfs
   index: 1
   end: 2095103
   start: 2048
Consumers:
1. Name: md1
   Mediasize: 1073741824 (1.0G)
   Sectorsize: 512
   Mode: r0w0e0


root@pipoca:/usr/src/sbin/geom/class/label # ls /dev/gpt/
efiboot	newtest	zfsboot

root@pipoca:/usr/src/sbin/geom/class/label # glabel refresh md1
Metadata from md1 refreshed.

root@pipoca:/usr/src/sbin/geom/class/label # ls /dev/gpt/
asiabsdcon	efiboot		zfsboot

Diff Detail

Event Timeline

araujo edited the summary of this revision. (Show Details)
araujo edited the test plan for this revision. (Show Details)
bcr added a subscriber: bcr.

OK from manpages.

This revision is now accepted and ready to land.Mar 10 2017, 1:59 PM

looks good to me beside the few style bug (inlined comment) please fix them before committing

sbin/geom/class/label/geom_label.c
247

style bug

251

style bug

This revision was automatically updated to reflect the committed changes.
trasz added a subscriber: trasz.
trasz added inline comments.
head/sys/geom/part/g_part.c
893 ↗(On Diff #26168)

Why not gpe_pp->acr as well?

This revision is now accepted and ready to land.Jun 22 2017, 4:24 PM
wblock added inline comments.
head/sbin/geom/class/label/glabel.8
193 ↗(On Diff #26168)

The slash with spaces form is usually ugly. Can't we just say "Rediscover" alone? Or "Reread"?