4

I have a server from OVH and have the following procedure of setting ZFS on FreeBSD10 on OVH server following the https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror

Creating a bootable ZFS Filesystem

zpool destroy zroot
gpart destroy -F ada0
gpart destroy -F ada1

gpart create -s gpt ada0
gpart create -s gpt ada1

gpart add -b 34 -s 64k -t freebsd-boot ada0
gpart add -s 8G -t freebsd-swap -l swap0 ada0
gpart add -t freebsd-zfs -l disk0 ada0

gpart add -b 34 -s 64k -t freebsd-boot ada1
gpart add -s 8G -t freebsd-swap -l swap1 ada1
gpart add -t freebsd-zfs -l disk1 ada1

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

Create ZFS Pool zroot

mkdir /tmp/zroot
zpool create -o cachefile=/boot/zfs/zpool.cache -m none -f zroot mirror /dev/gpt/disk0 /dev/gpt/disk1
zpool set bootfs=zroot zroot
zfs set checksum=fletcher4 zroot
zfs set mountpoint=/tmp/zroot zroot

zfs create -o compression=on -o exec=on -o setuid=off zroot/tmp

Installing FreeBSD to the ZFS filesystem

zfs create -o compression=on -o exec=on -o setuid=off zroot/tmp

chmod 1777 /tmp/zroot/tmp

zfs create zroot/usr

zfs create zroot/var
zfs create -o compression=lz4 -o exec=off -o setuid=off zroot/var/crash
zfs create -o exec=off -o setuid=off zroot/var/db
zfs create -o compression=lz4 -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=lz4 -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=lz4 -o exec=on -o setuid=off zroot/var/tmp

chmod 1777 /tmp/zroot/var/tmp

zpool export zroot

zpool import -o cachefile=/tmp/zpool.cache zroot

cd /tmp/zroot
mkdir fileinstall
cd fileinstall
fetch http://ftp1.fr.FreeBSD.org/pub/FreeBSD/releases/amd64/10.0-RELEASE/base.txz
fetch http://ftp1.fr.FreeBSD.org/pub/FreeBSD/releases/amd64/10.0-RELEASE/kernel.txz
fetch http://ftp1.fr.FreeBSD.org/pub/FreeBSD/releases/amd64/10.0-RELEASE/src.txz
fetch http://ftp1.fr.FreeBSD.org/pub/FreeBSD/releases/amd64/10.0-RELEASE/doc.txz
fetch http://ftp1.fr.FreeBSD.org/pub/FreeBSD/releases/amd64/10.0-RELEASE/ports.txz

sh

export DESTDIR=/tmp/zroot

for file in base.txz kernel.txz doc.txz src.txz ports.txz;
do (cat $file | tar --unlink -xpJf - -C ${DESTDIR:-/});
done


cp /tmp/zpool.cache /tmp/zroot/boot/zfs/zpool.cache

chroot /tmp/zroot /bin/sh

echo 'zfs_load="YES"' >> /boot/loader.conf
echo 'if_em_load="YES"' >> /boot/loader.conf
echo 'vfs.root.mountfrom="zfs:zroot"' >> /boot/loader.conf
echo 'geom_mirror_load="YES"' >> /boot/loader.conf

echo 'dumpdev="AUTO"' >> /etc/rc.conf
echo 'zfs_enable="YES"' >> /etc/rc.conf
echo 'sshd_enable="YES"' >> /etc/rc.conf
echo 'local_unbound_enable=yes' >> /etc/rc.conf
echo 'ifconfig_igb0="inet XXX.XXX.XXX.XXX netmask 255.255.255.0 broadcast XXX.XXX.XXX.XXX"' >> /etc/rc.conf

echo '# IPv6 configuration' >> /etc/rc.conf
echo 'ipv6_enable="YES"' >> /etc/rc.conf
echo 'ipv6_network_interfaces="igb0"' >> /etc/rc.conf
echo 'ipv6_activate_all_interfaces="YES"' >> /etc/rc.conf
echo 'ipv6_network_interfaces="auto"' >> /etc/rc.conf
echo 'ip6addrctl_policy="ipv6_prefer"' >> /etc/rc.conf
echo 'ifconfig_igb0_ipv6="inet6 2001:XXX:: prefixlen 64"' >> /etc/rc.conf
echo 'ipv6_static_routes="ovhgw"' >> etc/rc.conf
echo 'ipv6_route_ovhgw="2001:XXX:ff -prefixlen 128 -interface igb0"' >> /etc/rc.conf
echo 'ipv6_defaultrouter="2001:XXX:ff"' >> /etc/rc.conf
echo 'hostname="ns426770.ip-37-187-148.eu"' >> /etc/rc.conf

echo 'search ovh.net' >> /etc/resolv.conf
echo 'nameserver 213.186.33.99' >> /etc/resolv.conf

vi /tmp/zroot/etc/fstab
# Device                        Mountpoint              FStype  Options         Dump    Pass#
/dev/gpt/swap0                  none                    swap    sw              0       0
/dev/gpt/swap1                  none                    swap    sw              0       0
zroot                           /                       zfs     rw,noatime      0       0
zroot/tmp                       /tmp                    zfs     rw,noatime      0       0
zroot/usr                       /usr                    zfs     rw,noatime      0       0
zroot/usr/home                  /usr/home               zfs     rw,noatime      0       0
zroot/usr/ports                 /usr/ports              zfs     rw,noatime      0       0
zroot/usr/ports/distfiles       /usr/ports/distfiles    zfs     rw,noatime      0       0
zroot/usr/ports/packages        /usr/ports/packages     zfs     rw,noatime      0       0
zroot/usr/src                   /usr/src                zfs     rw,noatime      0       0
zroot/var                       /var                    zfs     rw,noatime      0       0
zroot/var/crash                 /var/crash              zfs     rw,noatime      0       0
zroot/var/db                    /var/db                 zfs     rw,noatime      0       0
zroot/var/db/pkg                /var/db/pkg             zfs     rw,noatime      0       0
zroot/var/empty                 /var/empty              zfs     ro              0       0
zroot/var/log                   /var/log                zfs     rw,noatime      0       0
zroot/var/mail                  /var/mail               zfs     rw,noatime      0       0
zroot/var/run                   /var/run                zfs     rw,noatime      0       0
zroot/var/tmp                   /var/tmp                zfs     rw,noatime      0       0


passwd root
vi /etc/ssh/sshd_config

exit
exit
cd /
zfs umount -a
zfs set mountpoint=legacy zroot
zfs set mountpoint=/tmp zroot/tmp
zfs set mountpoint=/usr zroot/usr
zfs set mountpoint=/var zroot/var


zfs create -V 4G zroot/swap
zfs set checksum=off zroot/swap
zfs set org.freebsd:swap=on zroot/swap
zfs set readonly=on zroot/var/empty

When I reboot the system, I am unable to access it and error on the OVH management screen, but as I don't have KVM access, I am unable to see the errors.

Is there anything I may have missed in my procedure?

2
  • 1
    You missed, getting KVM access. You will need it to sort this. May 18, 2014 at 15:51
  • ok, i have KVM access to the system, as i was behind a proxy, OVH's KVM did not work. will try again and report the errors
    – khinester
    May 19, 2014 at 8:18

1 Answer 1

2

ok, i missed the `echo 'defaultrouter="XXX.XXX.XXX.254"' otherwise all works fine

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .