Date: Thu, 04 Apr 2013 09:22:00 +0200 From: Henner Heck <Henner.Heck@web.de> To: freebsd-fs@freebsd.org Subject: Re: mounting failed with error 2 Message-ID: <515D2A18.6060305@web.de> In-Reply-To: <20825.62329.379765.344231@oz.mt.att.com> References: <20825.59038.104304.161698@oz.mt.att.com> <5159F0C9.9000302@FreeBSD.org> <20825.62329.379765.344231@oz.mt.att.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Am 01.04.2013 22:52, schrieb Jay Borkenhagen: > Andriy Gapon writes: > > on 01/04/2013 22:57 Jay Borkenhagen said the following: > > > Hi FS, > > > > > > I am attempting to follow Niclas Zeising's updated directions at > > > https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/9.0-RELEASE for > > > "Installing FreeBSD 9.0-RELEASE (or later) Root on ZFS using GPT." > > > > It doesn't appear that you've mentioned what version of FreeBSD you are using. > > Hi, > > I realized I had forgotten to write that as soon as I hit 'send'. :) > > I am using a vanilla 9.1-RELEASE memstick to install. > > Jay B. > > _______________________________________________ > freebsd-fs@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" > Hello, i too followed these instructions with the same result as you, "error 2" on boot. It seems to be all about the "zpool.cache" and when and how to export or not export the pool. After searching the web and trying out several modifications, the instructions below worked for me just yesterday with a FreeBSD 9.1-RELEASE Stick. The main change is not to export the pool before reboot and to create the zpool.cache at the end instead of copying an existing one, though i am not sure, if the second change is actually needed. Setting the pool's mountpoint to "none" might also not be necessary, but i'm a bit fed up with finding out right now by installing once again. I also modified the GPT partitioning a bit, but it is not crucial for success. ------------------------------------------------------------------------------------------------------------------------------- Edited version of https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/9.0-RELEASE 2013-02-07 22:06:22 by Niclas Zeising Modifications by Henner Heck -- Installing FreeBSD 9.1-RELEASE Root on ZFS using GPT Creating a bootable ZFS filesystem Note: This walkthrough assumes that a zfs mirror of two disks is created, but the instructions work equally well for a single disk or a raidz or raidz2 setup, just replace 'mirror' as needed in the examples. Boot FreeBSD install CD/DVD or USB Memstick. Go through the initial setup as usual. Choose the 'Shell' option at Partitioning dialog in bsdinstall Create gpt disks, repeat this for all disks. # gpart create -s gpt ada0 # gpart create -s gpt ada1 Add initial partitions for boot loader and swap, and install the protective MBR and gptzfsboot boot loader. It is possible to have swap partitions on zfs pools, but this might lead to deadlocks in low memory situations. The boot loader partition gets the maximum allowed size of 512k, the start positions of all following partitions are aligned to 1M. # gpart add -s 512k -t freebsd-boot -l boot0 ada0 # gpart add -a 1M -s 8G -t freebsd-swap -l swap0 ada0 # gpart add -a 1M -t freebsd-zfs -l disk0 ada0 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 # gpart add -s 512k -t freebsd-boot -l boot1 ada1 # gpart add -a 1M -s 8G -t freebsd-swap -l swap1 ada1 # gpart add -a 1M -t freebsd-zfs -l disk1 ada1 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 Load the necessary kernel modules # kldload opensolaris # kldload zfs Create the zfs pool. Replace mirror as needed, and add all disks that should be part of the pool. # zpool create -o altroot=/mnt -O canmount=off zroot mirror /dev/gpt/disk0 /dev/gpt/disk1 This will create a zpool called zroot, which will not be mounted. The canmount property is also set to off, to avoid mounting this by accident. This zpool is only used to derive other file systems from. Installing FreeBSD to the ZFS file system Create ZFS filesystem hierarchy The fletcher4 algorithm should be more robust than the fletcher2 algorithm. # zfs set checksum=fletcher4 zroot # zfs create -o mountpoint=/ zroot/ROOT # zfs create -o compression=on -o exec=on -o setuid=off -o mountpoint=/tmp zroot/tmp # chmod 1777 /mnt/tmp # zfs create -o mountpoint=/usr zroot/usr # zfs create zroot/usr/local # zfs create -o compression=lzjb -o setuid=off zroot/usr/ports # zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles # zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages Note: If you use nullfs or nfs to mount /usr/ports to different locations/servers, you will also need to nullfs/nfs mount /usr/ports/distfiles and/or /usr/ports/packages. # zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/usr/src # zfs create zroot/usr/obj # zfs create -o mountpoint=/var zroot/var # zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/crash # zfs create -o exec=off -o setuid=off zroot/var/db # zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/db/pkg # zfs create -o exec=off -o setuid=off zroot/var/empty # zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/log # zfs create -o compression=gzip -o exec=off -o setuid=off zroot/var/mail # zfs create -o exec=off -o setuid=off zroot/var/run # zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/tmp # chmod 1777 /mnt/var/tmp # zfs create -o setuid=off -o mountpoint=/home zroot/home Note: If /home is mounted from someplace else, such as using NFS there is no need to create zroot/home above. Note: Compression may be set to on, off, lzjb, gzip, gzip-N (where N is an integer from 1 (fastest) to 9 (best compresion ratio. gzip is equivalent to gzip-6). Compression will cause some latency when accessing files on the ZFS filesystems. Use compression on ZFS filesystems which will not be accessed that often. When all zfs filesystems are created, exit from the shell and proceed with the installation as normal. It will be possible to drop into a shell in the newly installed system and configure it at this point. When the installation is finished, choose the Live CD option and log in as root Finishing touches Enable ZFS in the startup configuration to mount zfs filesystems on startup. # echo 'zfs_enable="YES"' >> /mnt/etc/rc.conf # echo 'zfs_load="YES"' >> /mnt/boot/loader.conf # echo 'vfs.root.mountfrom="zfs:zroot/ROOT"' >> /mnt/boot/loader.conf Add swap devices to fstab, so that they will automatically show up when the system starts. # cat << EOF > /mnt/etc/fstab # Device Mountpoint FStype Options Dump Pass# /dev/gpt/swap0 none swap sw 0 0 /dev/gpt/swap1 none swap sw 0 0 EOF Set mountpoint of pool zroot to none # zfs set mountpoint=none zroot Set the bootfs: # zpool set bootfs=zroot/ROOT zroot Set read only on /var/empty, it is supposed to be empty at all times. # zfs set readonly=on zroot/var/empty Generate zpool cachefile, to be able to boot from the new pool. # zpool set cachefile=/mnt/boot/zfs/zpool.cache zroot To finish the installation, simply reboot from the Live CD, do not forget to remove the installation media from the computer. # reboot -------------------------------------------------------------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?515D2A18.6060305>