Grub has been a bit of a thorn in my side for a while now so I thought I'd spend some time trying to work out how I could copy my Solaris ZFS filesystem to a spare drive and configure grub to boot off this copy of my current OS.
It took a bit of trial and error but I got there in the end. This might not be the optimal way of doing this but I found this very helpful in lifting the lid on what happens during an install or live upgrade.
Anyway, here we go;
1. Slice up disk - make slice 0 the correct size for /, starting at block 1.
2. Create new rpool
zpool create -f rpool2 c3t0d0s0
zfs create rpool2/ROOT
3. Copy filesystem over
zfs snapshot rpool/ROOT/zfs_nv_116@mysnap
zfs send rpool/ROOT/zfs_nv_116@mysnap |zfs recv rpool2/ROOT/zfs_nv_copy
4. Make copied filesystem bootable
zpool set bootfs=rpool2/ROOT/zfs_nv_copy rpool2
zpool set failmode=continue rpool2
installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c3t0d0s0
zfs set mountpoint=/mnt rpool2/zfs_nv_copy
/mnt/boot/solaris/bin/update_grub -R /mnt
vi /rpool2/boot/grub/menu.lst
-> add bootfs line after findroot. ie;
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris Express Community Edition snv_116 X86
findroot (pool_rpool2,0,a)
bootfs rpool2/ROOT/zfs_nv_copy
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#---------------------END BOOTADM--------------------
5. Set up dump and swap devices
zfs create -V 6G rpool2/dump
Update /mnt/etc/dumpadm.conf
zfs create -V 16G -b 4k rpool2/swap
Update /mnt/etc/vfstab
zfs set canmount=noauto rpool2/ROOT/zfs_nv_copy
6. Now boot off the new disk and there will be a grub entry and it will boot from rpool2.
Other useful tips;
"bootadm list-menu" shows the location of the current active grub menu. Saves fruitless editing of /boot/grub/menu.lst
To see a different boot environment menu, just mount the filesystem under its full path (in the above example under /rpool2/ROOT/zfs_nv_copy) and run "bootadm list-menu -R /rpool2/ROOT/zfs_nv_copy"
Monday, November 9, 2009
Subscribe to:
Comments (Atom)
