Sunday, August 30, 2009

Clone boot disk to another disk with bigger partition

Created a 30gb partition in the second disk(c10t0d0)
choose disk1
If you receive the EFI label complaint
before you set-up mirror and after OS has been installed on a first
disk make sure you put SMI label on the second disk and partition it
exactly the same. Use format -e disk2 and then issue 'label' - it will
ask you if you want smi or efi label, choose smi. then do: prtvtoc
/dev/rdsk/disk1s2 | fmthard -s - /dev/rdsk/disk2s2

then, assuming your os is installed in s0 setup an mirror like:
#zpool attach rpool disk1s0 disk2s0

# prtvtoc /dev/rdsk/c8d0s2| fmthard -s - /dev/rdsk/c10t0d0s2
fmthard: Partition 2 specifies the full disk and is not equal
full size of disk. The full disk capacity is 62492850 sectors.
fmthard: New volume table of contents now in place.

#zpool attach rpool c8d0s0 c10t0d0s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c10t0d0s0 is part of exported or potentially active ZFS pool rpool. Please see zpool(1M).

#zpool attach -f rpool c8d0s0 c10t0d0s0
Zfs started resilvering process (check with zpool status)
Please be sure to invoke installgrub(1M) to make 'c10t0d0s0' bootable.

# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c10t0d0s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 271 sectors starting at 50 (abs 16115)

switched bootdisk and started up fine. I didn't want my mirror configuration any more so I did:
#zpool detach rpool c8d0s0