Categories
Internet, Unix en security

OpenSolaris 2008.11 with ZFS-mirroring

OpenSolarisBoth Sun Solaris and OpenSolaris now support ZFSboot which allows you to have your operating system on a ZFS-pool. Also the text-installer for Sun Solaris lets you define if you want your ZFSboot device to be mirrored, but with the OpenSolaris installer this option isn’t given and with the default options it isn’t even possible. This due to selection of the whole disk option for ZFS which appears to be a wise option for people who know ZFS. The truth is that you need to select Solaris partitions during installation if you want your ZFSboot environment to support mirroring.

After OpenSolaris has been installed you can turn on mirroring as in the good old days with SVM. The first step it get the VTOC the same on both disks.

$ pfexec prtvtoc /dev/rdsk/c3d0s2 | pfexec fmthard -s - /dev/rdsk/c4d1s2
fmthard: New volume table of contents now in place.

ZFS can be tolled to create a mirror and the resilvering starts.

$ pfexec zpool attach -f c3d0s0 c4d1s0

Now the last step is to install GRUB on the second disk.

$ pfexec installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c4d1s0

Afterwards I did a scrub to make sure the data on both disks was correct and the following output confirms I have mirrored my two disks.

$ zpool status
pool: rpool
state: ONLINE
scrub: scrub completed after 0h5m with 0 errors on Sat May 30 11:50:12 2009
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror ONLINE 0 0 0
c3d0s0 ONLINE 0 0 0
c4d1s0 ONLINE 0 0 0
errors: No known data errors

You’re ready to go and as long as you do a scrub on a regular basis the zpool should stay a safe place to store your data.

By Hans Spaans

Unix & security consultant with a passion for Linux, Solaris, PostgreSQL, Perl and network services, but also a strong believer in open and free source, standards and content.