-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add script to choose which rootfs to boot next #210
Conversation
0f2ee71
to
515dc2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new refactoring is good. It would be useful to be explicit about what is an upgrade
vs rootfs
container.
515dc2c
to
6a85635
Compare
6a85635
to
bb80135
Compare
This changes create a new upgrade script, rootfs-container, which can be used to configure which "rootfs container" to be used as the appliance's boot filesystem; i.e. the filesystem that will be used as the rootfs the next time the system boots. This logic had previously been contained in the "upgrade-container" script's "convert_to_bootfs" function, so this change simply moves this logic into a new script so it can be invoked seperately. As an example, take the following system: $ zfs list / NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT/delphix.a0Jj3pP/root 6.77G 32.2G 6.77G / $ sudo zfs list -r rpool/ROOT -d 1 NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT 31.6G 32.2G 65K none rpool/ROOT/delphix.a0Jj3pP 6.78G 32.2G 64K none rpool/ROOT/delphix.dREvZi4 18.0G 32.2G 64K none rpool/ROOT/delphix.g1RRkAS 6.84G 32.2G 65K none We can use this new script to switch the boot filesystem: $ sudo /var/dlpx-update/latest/rootfs-container set-bootfs delphix.dREvZi4 Installing for i386-pc platform. Installation finished. No error reported. Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-43-generic Found initrd image: /boot/initrd.img-4.15.0-43-generic done $ sudo reboot $ zfs list / NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT/delphix.dREvZi4/root 8.21G 31.9G 7.61G /
This change extends the "rootfs-container" script to enable the deletion of existing rootfs containers. For example, given the following system: $ sudo zfs list NAME USED AVAIL REFER MOUNTPOINT rpool 38.5G 28.9G 64K none rpool/ROOT 34.0G 28.9G 64K none rpool/ROOT/delphix.739W0dx 5.56G 28.9G 64K none rpool/ROOT/delphix.739W0dx/data 840K 28.9G 27.9M legacy rpool/ROOT/delphix.739W0dx/home 155K 28.9G 11.0G legacy rpool/ROOT/delphix.739W0dx/root 5.56G 28.9G 5.56G / rpool/ROOT/delphix.BTC02Vz 5.98G 28.9G 65K none rpool/ROOT/delphix.BTC02Vz/data 3.32M 28.9G 29.1M legacy rpool/ROOT/delphix.BTC02Vz/home 346K 28.9G 11.0G legacy rpool/ROOT/delphix.BTC02Vz/root 5.98G 28.9G 5.97G / rpool/ROOT/delphix.fuzt21y 5.54G 28.9G 64K none rpool/ROOT/delphix.fuzt21y/data 620K 28.9G 28.5M legacy rpool/ROOT/delphix.fuzt21y/home 152K 28.9G 11.0G legacy rpool/ROOT/delphix.fuzt21y/root 5.54G 28.9G 5.54G / rpool/ROOT/delphix.ns2t0fx 16.9G 28.9G 64K none rpool/ROOT/delphix.ns2t0fx/data 29.8M 28.9G 29.0M legacy rpool/ROOT/delphix.ns2t0fx/home 11.0G 28.9G 11.0G legacy rpool/ROOT/delphix.ns2t0fx/root 5.89G 28.9G 5.88G / rpool/crashdump 65.5K 17.4G 65.5K /var/crash rpool/grub 3.03M 28.9G 3.03M legacy rpool/update 4.48G 10.5G 4.48G /var/dlpx-update We can now use this new command to remove all but the currently booted rootfs container: $ sudo /var/dlpx-update/latest/rootfs-container delete delphix.BTC02Vz $ sudo /var/dlpx-update/latest/rootfs-container delete delphix.739W0dx $ sudo /var/dlpx-update/latest/rootfs-container delete delphix.ns2t0fx $ zfs list -t all NAME USED AVAIL REFER MOUNTPOINT rpool 21.1G 46.3G 64K none rpool/ROOT 16.6G 46.3G 64K none rpool/ROOT/delphix.fuzt21y 16.6G 46.3G 64K none rpool/ROOT/delphix.fuzt21y/data 30.4M 46.3G 28.9M legacy rpool/ROOT/delphix.fuzt21y/[email protected] 958K - 27.4M - rpool/ROOT/delphix.fuzt21y/[email protected] 298K - 27.4M - rpool/ROOT/delphix.fuzt21y/[email protected] 336K - 28.2M - rpool/ROOT/delphix.fuzt21y/home 11.0G 46.3G 11.0G legacy rpool/ROOT/delphix.fuzt21y/[email protected] 152K - 11.0G - rpool/ROOT/delphix.fuzt21y/[email protected] 143K - 11.0G - rpool/ROOT/delphix.fuzt21y/[email protected] 143K - 11.0G - rpool/ROOT/delphix.fuzt21y/root 5.58G 46.3G 5.58G / rpool/crashdump 65.5K 17.4G 65.5K /var/crash rpool/grub 3.03M 46.3G 3.03M legacy rpool/update 4.48G 10.5G 4.48G /var/dlpx-update Additionally, it'll prevent the user from deleting the rootfs container that's currently booted: $ zfs list / NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT/delphix.fuzt21y/root 5.57G 46.3G 5.57G / $ sudo /var/dlpx-update/latest/rootfs-container delete delphix.fuzt21y rootfs-container: cannot delete mounted rootfs container: 'delphix.fuzt21y'
This change builds on the previously added "set-bootfs" command of the "rootfs-container" script, now providing an easy way to "rollback" after booting to an upgraded rootfs container. This allows a user to easily revert an upgrade, if the upgrade is deemed unsuccessful. For example, one can run the following to perform an upgrade: $ sudo /var/dlpx-update/latest/upgrade -v not-in-place $ sudo reboot Now, after the reboot, if it's determined that the upgrade was not successful, one can run the following to rollback that prior upgrade: $ sudo /var/dlpx-update/latest/upgrade rollback $ sudo reboot At this point, the system will boot to the original root filesystem that was used prior ot the upgrade.
bb80135
to
c04a841
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FAQ is nice
bors r+ |
210: Add script to choose which rootfs to boot next r=prakashsurya a=prakashsurya This changes create a new upgrade script, rootfs-container, which can be used to configure which "rootfs container" to be used as the appliance's boot filesystem; i.e. the filesystem that will be used as the rootfs the next time the system boots. This logic had previously been contained in the "upgrade-container" script's "convert_to_bootfs" function, so this change simply moves this logic into a new script so it can be invoked seperately. As an example, take the following system: $ zfs list / NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT/delphix.a0Jj3pP/root 6.77G 32.2G 6.77G / $ sudo zfs list -r rpool/ROOT -d 1 NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT 31.6G 32.2G 65K none rpool/ROOT/delphix.a0Jj3pP 6.78G 32.2G 64K none rpool/ROOT/delphix.dREvZi4 18.0G 32.2G 64K none rpool/ROOT/delphix.g1RRkAS 6.84G 32.2G 65K none We can use this new script to switch the boot filesystem: $ sudo /var/dlpx-update/latest/rootfs-container set-bootfs delphix.dREvZi4 Installing for i386-pc platform. Installation finished. No error reported. Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-43-generic Found initrd image: /boot/initrd.img-4.15.0-43-generic done $ sudo reboot $ zfs list / NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT/delphix.dREvZi4/root 8.21G 31.9G 7.61G / Co-authored-by: Prakash Surya <[email protected]>
Build succeeded
|
This changes create a new upgrade script, rootfs-container, which can be
used to configure which "rootfs container" to be used as the appliance's
boot filesystem; i.e. the filesystem that will be used as the rootfs the
next time the system boots.
This logic had previously been contained in the "upgrade-container"
script's "convert_to_bootfs" function, so this change simply moves this
logic into a new script so it can be invoked seperately.
As an example, take the following system:
We can use this new script to switch the boot filesystem: