Sunday, 21 October 2018

How to Import Zpool and Mount of BE When Booted From Alternate Device in Solaris 11 By Devan

How to Import Zpool and Mount of BE When Booted From Alternate Device in Solaris 11

This post shows how to boot from an alternate device or media to update or fix a Solaris 11 instance. Boot the system from another bootable disk, installation DVD, or over the network. Ensure that the version of Solaris 11 on the alternate media matches the version of the Solaris 11 on the disk. For SPARC: If you boot from installation media or an installation server on the network, select the text installation. If you boot from an installation server, use the following command:
ok> boot net:dhcp
For x86: If you boot from installation media or an installation server on the network, select this text installation option from the GRUB menu:
Oracle Solaris 11 11/11 Text Installer and command line

Select option 3 Shell from the following menu:

                1  Install Oracle Solaris
                2  Install Additional Drivers
                3  Shell
                4  Terminal type (currently sun-color)
                5  Reboot

Please enter a number [1]: 3
To return to the main menu, exit the shell 

Exporting iso in LDoms as pseudo CDROM

1. On a system with LDoms, you can export an iso file as pseudo CDROM for a guest LDom as shown below. In this example, the ISO image is /export/images/sol-10-u8-ga-sparc-dvd.iso.
primary# ldm add-vdsdev /export/images/sol-10-u8-ga-sparc-dvd.iso dvd-iso@primary-vds0
primary# ldm stop-domain ldom1
2. Add the virtual disk for the ISO image to the logical domain.
primary# ldm add-vdisk s10-dvd dvd-iso@primary-vds0 ldom1
3. Restart the guest domain.
primary# ldm start-domain ldom1
4. Connect to the guest domain.
primary# telnet localhost 5000
5. Verify the existence of the ISO image as a virtual disk.
{0} ok show-disks
a) /virtual-devices@100/channel-devices@200/disk@1
b) /virtual-devices@100/channel-devices@200/disk@0
q) NO SELECTION
Enter Selection, q to quit: q
{0} ok devalias
dvd-iso                  /virtual-devices@100/channel-devices@200/disk@1
ldom1-root               /virtual-devices@100/channel-devices@200/disk@0
vnet0                    /virtual-devices@100/channel-devices@200/network@0
net                      /virtual-devices@100/channel-devices@200/network@0
disk                     /virtual-devices@100/channel-devices@200/disk@0
virtual-console          /virtual-devices/console@1
name                     aliases
In this example, the newly added device is dvd-iso
6. Boot the guest domain from the ISO image.
{0} ok boot dvd-iso -sv

Requesting System Maintenance Mode
SINGLE USER MODE

Enter user name for system maintenance (control-d to bypass): 

Enter user name for system maintenance (control-d to bypass): root
Enter root password (control-d to bypass):                                     ### when booting from ISO or DVD, the default root password for root is 'solaris'
single-user privilege assigned to root on /dev/console.
Entering System Maintenance Mode

Jan 22 11:53:14 su: 'su root' succeeded for root on /dev/console
Oracle Corporation    SunOS 5.11    11.3    September 2015
# 

Booting from the Network

Alternatively, you can boot from network into single-user-mode as shown below:
{0} ok boot net:dhcp -v -s

-- lines omitted --

Hostname: some-name.company.com

Requesting System Maintenance Mode
SINGLE USER MODE

Enter user name for system maintenance (control-d to bypass): root
Enter root password (control-d to bypass): 
single-user privilege assigned to root on /dev/console.
Entering System Maintenance Mode

Jul 30 14:14:54 su: 'su root' succeeded for root on /dev/console
Oracle Corporation      SunOS 5.11      11.1    September 2012

Importing ZFS pool

Once the system has booted to single-user-mode, import your ZFS root pool and look for existing boot environments.
1. check the existence of importable zpools and get the names and id’s of them:
root:~# zpool import
  pool: rpool
    id: 5584562336228605571
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

        rpool                      ONLINE
          c4t373185D25ECEB2ACd0s0  ONLINE
2. Import root zpool.
root:~# zpool import rpool
3. check the existing Solaris BEs:
root:~# beadm list
be_find_current_be: failed to find current BE name
BE                     Active Mountpoint Space  Policy Created
--                     ------ ---------- -----  ------ -------
solaris                -      -          16.56M static 2014-07-29 13:38
solaris-1              R      -          4.22G  static 2014-07-30 09:54
solaris.pre-first-boot -      -          63.0K  static 2014-07-29 14:10
4. mount the most recent BE.
root:~# mkdir /a
root:~# beadm mount solaris-1 /a
5. perform some actions of your choice. i.e. update the boot archive.
root:~# bootadm update-archive -v -f -R /a
forced update of archive requested
cannot find: /a/etc/cluster/nodeid: No such file or directory
cannot find: /a/etc/mach: No such file or directory
updating /a/platform/sun4v/boot_archive
Successfully created /a/platform/sun4v/boot_archive
6. umount the BE.
root:~# beadm umount solaris-1
7. reboot the system.
root:~# reboot
You also might check with boot option ‘-L’ in SPARC OBP whether you have a choice to boot different boot environments. On X86-systems, the GRUB menu provides a choice to boot from different boot environments:
{0} ok boot -L
Boot device: /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w373185d25eceb2ac,0:a  File and args: -L
1 Oracle Solaris 11.1 SPARC
2 solaris.pre-first-boot
3 solaris-1
Select environment to boot: [ 1 - 3 ]: 3

To boot the selected entry, invoke:
boot [] -Z rpool/ROOT/solaris-1

Program terminated
{0} ok boot -Z rpool/ROOT/solaris-1
-- boot messages --

No comments:

Post a Comment