31 Mar 2011, 21:06

(Re)Discovering FreeBSD and ZFS

Share

Since Sun’s killers euh Oracle shutdown OpenSolaris, FreeBSD is becoming more and more attracting with ZFS port, you should really give it a try (We are back baby).

Here is a fast installation of FreeBSD with a ZFS root.

Download http://mfsbsd.vx.sk/, a special iso image that will give you a ZFS on root FreeBSD with no pain.

Note that I’m using it over KVM on Gentoo: (kvm -hda /dev/vg0/freebsdvm_root -m 4096 -cdrom /opt/data/kvm/installer/mfsbsd-se-8.2-amd64.iso -net nic -net user -boot d), but you can test it with Virtualbox, vmware, real installation …

At prompt login as root with password **mfsroot.

mount_cd9660 /dev/acd- /cdrom_  
zfsinstall -d /dev/ad0 -t /cdrom/8.2-RELEASE-amd64.tar.xz  
chroot /mnt  
vi /etc/rc.conf

Add:

sshd_enable="YES_  
hostname="freebsdvm"  
ifconfig_re0="DHCP"  
zfs create -V 2G tank/swap  
zfs set org.freebsd:swap=on tank/swap  
zfs set checksum=off tank/swap  
reboot  

Restart your vm (kvm -hda /dev/vg0/freebsdvm_root -m 4096 -net nic -net user )

log in as root no password
set a password

zfs set atime=off tank   
zfs create tank/root/usrports _# this is not a typo 
zfs set compression=gzip tank/root/usrports  
zfs set mountpoint=/usr/ports tank/root/usrports  
zfs create tank/root/usrports/distfiles  
zfs compression=off tank/root/usrports/distfiles

Install the ports with the methods you want. (http://www.freebsd.org/doc/handbook/ports-using.html)

portsnap fetch  
portsnap extract  
      
cd /usr/ports/shell/bash  
make install clean  

Adduser Put your user in the wheel group (admin)_

cd /usr/ports/ports-mgmt/portupgrade 
make install clean  
      
cd /usr/ports/security/sudo  
make install clean
      
cd /usr/ports/ports-mgmt/portaudit  
make install clean  
      
cd /usr/ports/sysutils/lsof  
make install clean

# update your system  
      
freebsd-update fetch  
freebsd-update install  
   
portsnap fetch  
portsnap update  
      
portaudit -F  
      
portupgrade -ai