czwartek, 5 czerwca 2008

Live Upgrade, BUGi i ZFS

W Solaris Express Comminity Edition b90 (SXCE90) doszła
obsługa głównego systemu plików jako ZFS.
Co ciekawe oprócz instalatora (próbowałem tylko tekstowego) obsługę /
jako ZFS mają również narzędzia od Live Upgrade.
Dodatkowo można zmigrować obecny system zainstalowany na UFS
na dodatkową pulę ZFS.
Wszystko ładnie i pięknie, ale jest niestety BUG (6707013), który utrudnia życie...

Na potrzeby testów usunąłem jedno środowisko uruchomieniowe,
w jego miejsce zrobiłem nową pulę ZFS:

# zpool create rpool c0d0s4
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c0d0s4 contains a ufs filesystem.
# zpool create -f rpool c0d0s4

# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
data 23,2G 4,78G 18,5G 20% ONLINE -
rpool 11,7G 95,5K 11,7G 0% ONLINE -

Tworzymy nowe środowisko uruchomieniowe na nowej puli ZFS:
# lucreate -n be_zfs_b90 -p rpool
Checking GRUB menu...

This system contains only a single GRUB menu for all boot environments. To
enhance reliability and improve the user experience, live upgrade requires
you to run a one time conversion script to migrate the system to multiple
redundant GRUB menus. This is a one time procedure and you will not be
required to run this script on subsequent invocations of Live Upgrade
commands. To run this script invoke:

/usr/lib/lu/lux86menu_propagate /path/to/new/Solaris/install/image

where /path/to/new/Solaris/install/image is an absolute
path to the Solaris media or netinstall image from which you installed the
Live Upgrade packages.


System musi zaktualizować /boot/grub/menu.lst ...
W tym celu montujemy płytkę z SXCE90:
# lofiadm -a /mnt/new/sxce90.iso
/dev/lofi/1
# mount -F hsfs -o ro /dev/lofi/1 /mnt/x/

Nie wiem dlaczego, ale musiałem usunąć inne BE, aby Live Upgrade zadziałało...

# lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
be0_snv90 yes yes yes no -
be1_snv89 yes no no yes -

# ludelete -n be1_snv89

This system contains only a single GRUB menu for all boot environments. To
enhance reliability and improve the user experience, live upgrade requires
you to run a one time conversion script to migrate the system to multiple
redundant GRUB menus. This is a one time procedure and you will not be
required to run this script on subsequent invocations of Live Upgrade
commands. To run this script invoke:

/usr/lib/lu/lux86menu_propagate /path/to/new/Solaris/install/image

where /path/to/new/Solaris/install/image is an absolute
path to the Solaris media or netinstall image from which you installed the
Live Upgrade packages.

Unable to delete boot environment.

Usunąłem je ręcznie:
# vi /etc/lutab

# cat /etc/lutab
# DO NOT EDIT THIS FILE BY HAND. This file is not a public interface.
# The format and contents of this file are subject to change.
# Any user modification to this file may result in the incorrect
# operation of Live Upgrade.
1:be0_snv90:C:0
1:/:/dev/dsk/c0d0s0:1
1:boot-device:/dev/dsk/c0d0s0:2

# lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
be0_snv90 yes yes yes no -


Kontynuujemy migrację wpisów bootloadera:

# /usr/lib/lu/lux86menu_propagate /mnt/x/
Validating the contents of the media .
The media is a standard Solaris media.
The media contains a Solaris operating system image.
The media contains version <11>.
Installing latest Live Upgrade packages from media
Updating Live Upgrade packages on all BEs
Successfully updated Live Upgrade packages on all BEs
Successfully extracted GRUB from media
Extracted GRUB menu from GRUB slice
Installing GRUB bootloader to all GRUB based BEs
stage1 written to partition 1 sector 0 (abs 29398950)
stage2 written to partition 1, 264 sectors starting at 50 (abs 29399000)
System does not have an applicable x86 boot partition
install GRUB to all BEs successful
Converting root entries to findroot
Generated boot signature for BE
Converting GRUB menu entry for BE
Added findroot entry for BE to GRUB menu
No more bootadm entries. Deletion of bootadm entries is complete.
Changing GRUB menu default setting to <8>
Done eliding bootadm entries.
No x86 boot partition
File
propagation successful
Menu propagation successful
No x86 boot partition
File
deletion successful
Successfully deleted GRUB_slice file
No x86 boot partition
File
deletion successful
Successfully deleted GRUB_root file
Propagating findroot GRUB for menu conversion.
No x86 boot partition
File
propagation successful
No x86 boot partition
File
propagation successful
No x86 boot partition
File propagation successful
Deleting stale GRUB loader from all BEs.
No x86 boot partition
File deletion successful
No x86 boot partition
File deletion successful
No x86 boot partition
File deletion successful
Conversion was successful


Tworzymy nowe środowisko na ZFS, pulę podajemy po parametrze "-p":

# lucreate -n be_zfs_b90 -p rpool
Checking GRUB menu...
System has findroot enabled GRUB
Analyzing system configuration.
Comparing source boot environment file systems with the file
system(s) you specified for the new boot environment. Determining which
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
The device
is not a root device for any boot environment; cannot get BE ID.
Creating configuration for boot environment .
Source boot environment is .
Creating boot environment .
Creating file systems on boot environment .
Creating file system for in zone on .
Populating file systems on boot environment .
Checking selection integrity.
Integrity check OK.
Populating contents of mount point
.
Copying.
[...]

{na innej konsoli:
> df -h | egrep 'c0d0|rpool'
/dev/dsk/c0d0s0 12G 6,4G 5,0G 57% /
rpool 12G 19K 3,3G 1% /rpool
rpool/ROOT 12G 18K 3,3G 1% /rpool/ROOT
rpool/ROOT/be_zfs_b90 12G 6,3G 3,3G 66% /.alt.tmp.b-Wzb.mnt
}

[...]
Creating shared file system mount points.
Segmentation Fault - core dumped
Segmentation Fault - core dumped
Creating compare databases for boot environment .
Creating compare database for file system
.
Updating compare databases on boot environment .
Making boot environment bootable.
Updating bootenv.rc on ABE .
ERROR: File
not found in top level dataset for BE
ERROR: Failed to copy file
from top level dataset to BE
ERROR: Unable to delete GRUB menu entry for boot environment .
ERROR: Cannot make file systems for boot environment .


No i zaczyna się :) Nie mam zarówno czasu, ani chęci szukać co poszło nie tak,
jednak szybko patrząc w core widzę, że jakiś system plików był już zamontowany.

System na ZFS się nie uruchomi, trzeba zrobić jeszcze małą sztuczkę ...

# zfs set mountpoint=legacy rpool/ROOT/be_zfs_b90
# cd /etc/lu

(powinienem mieć ICF.2, jednek LU go nie utworzył...)
# cp ICF.1 ICF.2
# vi ICF.2
# cat ICF.2
be_zfs_b90:-:/dev/dsk/c0d0s1:swap:2104515
be_zfs_b90:/:rpool/ROOT/be_zfs_b90:zfs:0

# lumount -n be_zfs_b90
/.alt.be_zfs_b90
# luumount -n be_zfs_b90

# luactivate -n be_zfs_b90
System has findroot enabled GRUB
Generating boot-sign, partition and slice information for PBE

Generating boot-sign for ABE
ERROR: File
not found in top level dataset for BE
Generating partition and slice information for ABE
Boot menu exists.
Generating direct boot menu entries for PBE.
Generating xVM menu entries for PBE.
Generating direct boot menu entries for ABE.
Generating xVM menu entries for ABE.
No more bootadm entries. Deletion of bootadm entries is complete.
GRUB menu default setting is unaffected
Done eliding bootadm entries.

**********************************************************************

The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the
target BE.

**********************************************************************

In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:

1. Boot from Solaris failsafe or boot in single user mode from the Solaris
Install CD or Network.

2. Mount the Parent boot environment root slice to some directory (like
/mnt). You can use the following command to mount:

mount -Fufs /dev/dsk/c0d0s0 /mnt

3. Run utility with out any arguments from the Parent boot
environment root slice, as shown below:

/mnt/sbin/luactivate

4. luactivate, activates the previous working boot environment and
indicates the result.

5. Exit Single User mode and reboot the machine.

**********************************************************************

Modifying boot archive service
Activation of boot environment successful.



# cat /etc/bootsign
BE_be0_snv90

# lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
be0_snv90 yes yes no no -
be_zfs_b90 yes no yes no -

# lumount -n be_zfs_b90
/.alt.be_zfs_b90
# cat /.alt.be_zfs_b90/etc/bootsign
cat: cannot open /.alt.be_zfs_b90/etc/bootsign: No such file or directory

# echo "be_zfs_b90" > /.alt.be_zfs_b90/etc/bootsign
# cat /.alt.be_zfs_b90/etc/bootsign
be_zfs_b90
# luumount -n be_zfs_b90

W zasadzie, to chyba wszystko, po 'init 6' pojawi się nowe menu w GRUBie.

# init 6

[...]

# uname -srv
SunOS 5.11 snv_90
# lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
be0_snv90 yes no no yes -
be_zfs_b90 yes yes yes no -
# df -h | head -2
Filesystem size used avail capacity Mounted on
rpool/ROOT/be_zfs_b90 12G 6,7G 2,8G 71% /
# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 182,2 8 2105336 2105336
#


Brak komentarzy: