Re: Installing a system onto ZFS

From: 韓家標 Bill Hacker <askbill_at_conducive.net>
Date: Sat, 06 Oct 2007 05:18:55 -0400
Stefan Esser wrote:
> Aristedes Maniatis wrote:
>> Yesterday I tried to install (using the August 2007 snapshot iso) a new
>> FreeBSD system using ZFS. This is what I did:
>>
>> * boot from CD
>> * type "load ZFS" on the boot loader prompt (could this be made default
>> for FreeBSD 7 release?)
>> * drop into the live CD shell and use fdisk, disklabel and zfs to create
>> the appropriate partitions (/boot which is UFS2 and /usr /tmp /var /
>> which are ZFS). ZFS volumes are created inside ad4s1d.
>>
>> A problem is then that the installer tries to mount the partitions and
>> presumably knows nothing about the ZFS partitions I mounted within the
>> live CD shell. Is there a way to do this, or am I expecting too much of
>> the installer tool at this early stage of ZFS in FreeBSD?
>>
>> It appears that the only alternative is to install a full system onto
>> UFS2 partitions, install a second disk with ZFS volumes, copy across the
>> data and set up the boot loader on the second drive, then discard the
>> first drive. Is that what others are doing?
> 
> What I do is install a minimal system into the UFS root (ad4s1a or
> whatever, to become the boot partition). Then I create the ZFS
> volumes from within, mounted on a temporary mount-point and copy
> over the whole contents of the minimum installation. After that, I
> fix the fstab entry in ZFS and prepare mounting of the boot partition
> on a directory in the ZFS root (fstab, mount point). Finally, I add
> the boot_from entry to /boot/loader.conf (on the boot partition).
> 
> After booting for the first time with a ZFS root (the temporary
> mount point where the ZFS file system have been initially mounted
> after creation is ignored, if a ZFS file system is accepted as the
> root file system), I clean up the UFS boot partition to only hold
> /boot, rescue (and for the time being /bin, /lib and /etc, which
> allows to override the root partition from the loader and instead
> boot with a minimal UFS root again ...)
> 
> 
> In short: Minimal install to (e.g.) ad4s1a (where ad4s1 also has a
> reasonably sized SWAP and the rest as ad4s1d for ZFS). Just select
> to create a 512MB root FS in the installer, the swap partition and
> use the rest for an UFS partition to be mounted on a dummy mount
> point (which you are going to unmount before you start creating
> ZFS file systems in that space). Then proceed as normal with the
> installation, boot to single user, create ZFS pool and file systems,
> copy over the contents of the UFS file system, patch fstab and
> loader.conf and create a mount point for /boot reboot and you are
> running on a ZFS root without the need for a second disk drive.
> 
> 
> This does not take half as long as the text may suggest, and the
> minimal installation is small enough to fit into a reasonably sized
> boot partition (I use 512MB, since I often keep multiple old kernels,
> but 256 should be enough and you might even get along with 128MB,
> but I never tried that since it is too small to keep my kernels).
> 
> Regards, STefan

Your description, with perhaps a bit of editing, looks like something that might 
be a good addition to docs and howto's.

Unless someone has an even faster, simpler more robust way?

Bill
Received on Sat Oct 06 2007 - 07:18:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:18 UTC