Hi,
This is a report of my latest investigations on how to setup (by hand) your ZFS
root filesystem.
My experiment was carried on with Solaris Express Community Edition b66 DVD and
an additional disk slice to temporarily install the root fs to. It takes place
during the installation process as a post install task.
First of all, you will need to enter Solaris Express interactive installation,
which should be default if you don''t do something else early in the
SXCE DVD boot. Take care to say No to the "automatic reboot by end of
installation" question. Then setup your installation as you would normally,
choosing your preferences. Note that you will need two disk slices for the
installation, one UFS (which the installer automatically configures) and one for
the root ZFS pool, which you will configure yourself. So the less packages you
install to the UFS slice, the smaller it will need to be, thus the larger the
final ZFS slice can be. After switching the root fs to ZFS, you will be able to
install the remaining packages directly into it. One option is to use the
temporary UFS slice for an additional swap slice.
After installation has finished the installer will present you with a reboot
prompt. Don''t reboot yet.
For the ZFS root setup, use the following as a reference for the commands:
[1] http://opensolaris.org/os/community/zfs/boot/zfsboot-manual/
Note that the commands I provide below are just examples. They must be changed
to work in your environment (mostly names for disks, slices, ZFS pools and
filesystems). You are required to know what you are doing regarding this.
Now the ZFS root will be prepared:
1. create the root pool and root fs as desired, as per step 3 in [1]:
# zpool create rootpool c0d0s3
# zfs create rootpool/rootfs
# zfs set mountpoint=legacy rootpool/rootfs
# mkdir /zfsroot
# mount -F zfs rootpool/rootfs /zfsroot
You don''t need to add it to /etc/vfstab.
2. Export the root pool you just created.
# zpool export rootpool
Now we will reimport it, taking care to let the system create a zpool.cache
file. This extra step is needed because the DVD installation mounts /etc
read-only and zpool.cache doesn''t get created.
# mount -F lofs /etc/zfs /tmp/root
# zpool import rootpool
# umount /tmp/root
This will create a zpool.cache file in /tmp/root (which should be your current
directory). Keep this file, you will need it later.
WARNING: take special care not to export the root pool. Exporting it will leave
some information on the pool headers that it is not online and ZFS boot will
panic.
3. copy the recently installed root fs to the ZFS root you created, as per step
4 in [1]:
# (cd /a; find . -xdev -depth -print | cpio -pvdm /zfsroot)
Note that this is a fresh installation and everything you need to copy is copied
in the above step.
Now you have to adjust a few parameters in your ZFS root fs.
4. Edit /zfsroot/etc/vfstab and replace the line that mounts the root filesystem
at / with one that mounts your ZFS root filesystem instead. You will comment the
existing line out and insert a new line like this:
rootpool/rootfs - / zfs - no -
5. Edit /zfsroot/boot/solaris/bootenv.rc and edit the bootpath property so that
it points to your ZFS root slice instead of the UFS one. Usually this will
entail changing just the last character of the path (which designates the
slice), if both filesystems are on the same disk.
6. Add the zpool.cache file you created to the ZFS root fs:
# cp /tmp/root/zpool.cache /zfsroot/etc/zfs
7. Add the zpool.cache to filelist.ramdisk.
# cat ''etc/zfs/zpool.cache'' >>
/zfsroot/boot/solaris/filelist.ramdisk
8. Update the boot archive:
# bootadm update-archive -v -R /zfsroot
Note that the -v option will tell you whether etc/zfs/zpool.cache was actually
added to the boot archive.
9. Setup grub. N.B. In my disk, grub lives in its own exclusive UFS slice, so
all I did was create the correct entry on its menu.lst. If you want grub to
reside on the slice where your ZFS root fs is located, then follow the
instructions in [1] (steps 6 & 7).
10. Reboot. On the next boot, if your ZFS root fs appears on the grub menu, you
should be able to boot the newly installed Solaris version from a ZFS
filesystem.
Comments and suggestions to enhance this are welcome.
-- Douglas
This message posted from opensolaris.org