The growfs_fstab script is a helper for the growfs script to add any
new swap partition to /etc/fstab on first boot. If growfs adds a
swap partition, it sets growfs_swap_added=1 in the kenv. In this
case, after the root file system is read/write, if there is no swap
partition in the fstab, growfs_fstab labels the swap partition as
growfs_swap, and adds that as a swap partition to the fstab. Also,
if there is no dumpdev line in /etc/rc.conf, it adds dumpdev="AUTO"
to rc.conf and runs dumpon (as this happened earlier in the startup
sequence).
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 48628 Build 45514: arc lint + arc unit
Event Timeline
libexec/rc/rc.d/growfs_fstab | ||
---|---|---|
64–68 | I wonder if sysrc(8) may simplify/improve this block. As dumpdev may be somewhere else (rc.conf(5)). |
libexec/rc/rc.d/growfs_fstab | ||
---|---|---|
64–68 | While looking at this, I discovered that the default value of dumpdev is AUTO (/etc/defaults/rc.conf), so adding to /etc/rc.conf is unneeded. I'll redo this using sysrc to check for AUTO, then do the dumpon. Thanks! |
Is there a reason not to just do this in the growfs script, when it creates the swap partition?
Yes, the root filesystem is read-only when growfs runs (BEFORE: root), and this runs after it is made read/write. The swap part could now be done earlier (previously it modified rc.conf), although it doesn't really matter.
No need to add dumpdev to /etc/rc.conf; the default is AUTO.
Just use $dumpdev, and enable dump if AUTO is the current value.
Move the code to find and label the swap partition to growfs.
Change the kenv variable that is used to growfs_swap_pdev, as this
is used internally in growfs. No need to add dumpdev="AUTO" to
rc.conf, as that is the default; just check for it before adding
dumpdev.
libexec/rc/rc.d/growfs_fstab | ||
---|---|---|
64–68 | I think it is worth noting that dumpdev="AUTO" is the default only for -CURRENT, not for RELEASE branches. |
libexec/rc/rc.d/growfs_fstab | ||
---|---|---|
64–68 | Thanks. I have no intention to MFC this currently. If that changes, I might reconsider this, although it might be best to leave the default in place here. |