Install your Solaris OS on ZFS
众所周知的,在 Opensolaris Navada 62 的版本中已经支持了 ZFS root for x86,
参见,http://www.opensolaris.org/os/community/zfs/boot/
但是缺省安装仍然是在 UFS 上,用户需要参照 http://www.opensolaris.org/os/community/zfs/boot/zfsboot-manual/
将 UFS 转换到 ZFS 上。这里提供了一个脚本 http://blogs.sun.com/timf/entry/zfs_bootable_datasets_happily_rumbling
ZFS 的下一个目标就是作为缺省安装的文件系统,这一项目在 Newboot 集成到 Navada 之后准备条件已经充足。目前这个项目正在开发和测试阶段,不久将在 OpenSolaris 社区的新版本中推出。作为测试成员中的一员,我有幸对其安装过程有了一个初步体验。
(1) 用户可以在安装时选择文件系统类型,UFS/ZFS,如果 UFS,那么与此前的安装没有任何变化
(2) 选取一些磁盘设备作为创建 rootpool 的物理设备,请注意,
rootpool can be a single disk device, or a device slice, or in a mirrored configuration. If you use a whole disk for a rootpool, you must use a slice notation (e.g. c0d0s0) so that it is labeled with an SMI label.
(3) 配置 rootpool 和文件系统的名称,以及指定 swap 和 dump 分区的大小,例如,
Storage Pool: rootpool
File system: rootfs
Swap: 1g
Dump: 2g
(4) 继续安装,所有的软件包将安装在指定的ZFS文件系统上,安装结束后,系统自动进入 ZFS root
如果用户此前有安装在 UFS 系统上的 Solaris,希望将其转换升级到 ZFS root 上,那么需要通过 LiveUpgrade 的方式(以下步骤假设您已经拥有了包含 ZFS install 特性的光盘或网络安装介质,Suppose you've get the CD/Netinstall image which contain ZFS install feature! )
If your system is an old OS, such as Solaris 10, s10 update x, s9, s8, snv before the zfs install OS, You should do LiveUpgrade( step 1 & 2) or Upgrade install to the new OS on UFS at first.
If already has the zfs install OS feature, it could bypass the step (2), but still need (1) to upgrade the package of LU.
(1) 升级 LU 的软件包
LOC=<CD/netinstall image>
$LOC/Solaris_11/Tools/Installers/liveupgrade20 -nodisplay
if [[ $? -ne 0 ]]; then
echo "liveupgrade20 fails!"
exit 1
fi
(2) UFS Liveupgrade, an extra blank slice needed, such as /dev/dsk/c0t0d0s7
# lucreate -c oldBE -n ufsBE -m /:<slice>:ufs
# luupgrade -u -n ufsBE -s $LOC
# luactivate ufsBE
# init 6
Now the system will become NewOS on UFS, then if you want to convert UFS->ZFS, do following steps,
(3) 选取一些磁盘设备作为创建 rootpool 的物理设备,请注意:
rootpool can be a single disk device, or a device slice, or in a mirrored configuration. If you use a whole disk for a rootpool, you must use a slice notation (e.g. c0d0s0) so that it is labeled with an SMI label.
(4) 创建 rootpool
# zpool create -f rootpool <vdev>
(5) LiveUpgrade
# lucreate -c ufsBE -n rootfs -p rootpool
# luupgrade -u -n rootfs -s $LOC
# luactivate rootfs
# init 6
系统重新启动后,如果一切顺利将进入 ZFS root,你可以通过以下命令查验当前状态
# df -k
Filesystem kbytes used avail capacity Mounted on
rootpool/BE/rootfs 17289216 2880402 11784717 20% /
/devices 0 0 0 0% /devices
/dev 0 0 0 0% /dev
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 592052 488 591564 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
sharefs 0 0 0 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap2.so.1
14665119 2880402 11784717 20% /lib/libc.so.1
fd 0 0 0 0% /dev/fd
swap 591656 92 591564 1% /tmp
swap 591608 44 591564 1% /var/run
/dev/dsk/c2t0d0s2 61316 61316 0 100% /media/CDROM
rootpool/export 17289216 19 11784717 1% /export
rootpool/export/home 17289216 19 11784717 1% /export/home
ts-auto-pool 28160 18 28055 1% /ts-auto-pool
# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rootpool/swap 182,1 8 1048568 1048568
# dumpadm
Dump content: kernel pages
Dump device: /dev/zvol/dsk/rootpool/dump (dedicated)
Savecore directory: /var/crash/woopass
Savecore enabled: yes
I will run some more experiment on ZFS root and post afterwards.
Have fun! Thanks for your interest of ZFS, especially, ZFS rock on / !
Good instruction...
发表于 eric 在 2008年11月21日, 10:47 上午 HKT #