When updating my 89-year old mother’s PC, I found it very useful to be able to reboot (one time only) from one boot partition direct to another partition on her PC.
Why ?
I live in Europe, and my mother lives in North America. I find this is very useful when I am accessing her PC remotely (from Europe, when her PC is in North America), and I need to access a different partition on her PC, and I do not want to ask her to reboot the PC.
To perform the reboot, I use the program ‘grub2-reboot’ that comes with grub2. The command is very basic (sent from a konsole in KDE) :
grub2-reboot [option] MENU_ENTRY
where MENU_ENTRY is a number, a menu item title or a menu item identifier. Rather than possibly ‘fight’ with the syntax a menu item title, I chose instead to use the menu item # identifier.
This menu item # identifier is a number where the numbers correspond to the entries in the grub menu.
The number is relatively easy to deduce, just by looking at the Grub2 menu when the PC boots. For example, in the case of my mother’s PC, her grub2 boot entries are (approximately – in order):
- Primary boot – openSUSE-13.2
- Primary boot – Advanced options for openSUSE-13.2
- Backup boot – openSUSE-13.2
- Backup boot - Advanced options for openSUSE-13.2
- Windows7 (on /dev/sdb1)
- Windows7 (on /dev/sdb2)
- Window Recovery
- Old harddrive openSUSE-13.1
- Old harddrive – Advanced options for openSUSE-13.1
To explain a bit, my mother’s PC has 3 separate openSUSE GNU/Linux installs (in separate partitions/drives) and a Windows7 install. The two openSUSE-13.2 installs are identical and are located in separate partitions on a new 1TB hard drive. The Windows7 install and the openSUSE-13.1 install are on on old hard drive that is giving some potential symptoms of failing, but has not failed yet.
The ‘new’ 1TB hard drive, I purchased last week for her PC, installed it in her PC (next to her old possibly failing hard drive) and put the two openSUSE-13.2 installs on that drive. In her PCs BIOS I setup that new hard drive as the ‘primary’ boot hard drive.
Why two openSUSE-13.2 installs (in addition to an old failing install) ? This way if one gets corrupted, she has a back up openSUSE-13.2 to boot to, in addition to having her old openSUSE-13.1 to boot to. Take a look at this blog entry which resulted in me adopting this approach: openSUSE Forums
Since I am in Europe and she is in North America, her having this additional redundancy makes the possibility of her not being able to boot her PC much less. If one of her partitions does have some corruption, there is a good chance when she boots to her backup, I can then log on to her PC remotely from Europe, and repair the failed hard drive partition.
But I want to keep all her openSUSE’s up to date (as long as there is support from SuSE-GmbH), and hence if she leaves her PC powered (in the Primary Boot – openSUSE-13.2) I want to be able to command a reboot to either of the other two openSUSE installs. I will then access those remotely and update those openSUSE versions. AND I do not need to bother her while I remotely perform these reboots and updates (from over 7000km away).
The ‘numbers’ (MENU_ENTRYs) I used for ‘grub2-reboot’ command were as follows:
- Primary boot – openSUSE-13.2
- Primary boot – Advanced options for openSUSE-13.2
- Backup boot – openSUSE-13.2
- Backup boot - Advanced options for openSUSE-13.2
- Windows7 – DO NOT USE - (on /dev/sdb1)
- Windows7 – DO NOT USE - (on /dev/sdb2)
- Window Recovery – DO NOT USE
- Old harddrive openSUSE-13.1
- Old harddrive – Advanced options for openSUSE-13.1
For example, to reboot to the ‘Backup boot’ … - After she has started the PC to the “Primary boot – openSUSE-13.2” (which is the default boot) she will then leave the PC running. Then I will conduct an update on the ‘Primary boot’, and then restart the PC to the Backup boot, using the commands (in a konsole) with root permissions:
grub2-reboot 3
shutdown -r now
and the PC will then reboot to the “Backup boot – openSUSE-13.2”. The next time I restart the PC, it will go back to its default “Primary boot – openSUSE-13.2”.
Wrt the Grub2 entry orders and labels, I used the GUI program “grub-customizer” to name the Grub2 entries and also to place the Grub2 entries in the order that I want to use.
The above is very basic, but I do find it quite useful.
Edit - I should note my mother’s partitions are EXT4. I have read grub2-reboot has some problems with btrfs (reference : Bug 856391 – grub2-reboot sets default boot entry permanently <==== where I do not know if that bug report has been fully addressed/fixed yet).