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)
Fri, Dec 6, 6:35 AM
Unknown Object (File)
Oct 5 2024, 5:06 AM
Unknown Object (File)
Oct 5 2024, 4:21 AM
Unknown Object (File)
Oct 4 2024, 10:47 PM
Unknown Object (File)
Oct 2 2024, 8:06 AM
Unknown Object (File)
Oct 2 2024, 4:52 AM
Unknown Object (File)
Sep 29 2024, 5:52 PM
Unknown Object (File)
Sep 17 2024, 11:07 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"?