Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 22nd, 2012  |  syntax: Bash  |  size: 2.86 KB  |  views: 52  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. echo "*** build zfs volumes ***"
  2.  
  3. sysctl kern.geom.debugflags=16
  4.  
  5.  
  6. gpart delete -i 3 da0
  7. gpart delete -i 2 da0
  8. gpart delete -i 1 da0
  9. gpart delete -i 3 da1
  10. gpart delete -i 2 da1
  11. gpart delete -i 1 da1
  12. gpart destroy da0
  13. gpart destroy da1
  14.  
  15. gpart create -s gpt da0
  16. gpart create -s gpt da1
  17.  
  18. gpart add -b 34 -s 64K -t freebsd-boot da0
  19. gpart add -t freebsd-zfs -l disk0 da0
  20. gpart add -b 34 -s 64K -t freebsd-boot da1
  21. gpart add -t freebsd-zfs -l disk1 da1
  22.  
  23. gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
  24. gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da1
  25.  
  26. kldload /boot/kernel/opensolaris.ko
  27. kldload /boot/kernel/zfs.ko
  28.  
  29.  
  30. zpool create -f -m /mnt zroot mirror /dev/gpt/disk0 /dev/gpt/disk1
  31. zpool set bootfs=zroot zroot
  32. zfs set checksum=fletcher4                                      zroot
  33.  
  34. #zfs set mountpoint=/mnt                                                zroot
  35.  
  36. zfs create -V 8G zroot/swap
  37. zfs set org.freebsd:swap=on zroot/swap
  38. zfs set checksum=off zroot/swap
  39.  
  40. zfs create                                                      zroot/home
  41.  
  42. zfs create                                                      zroot/usr
  43. #cd /mnt/usr ; ln -s ../home home
  44.  
  45. zfs create -o compression=lzjb                  -o setuid=off   zroot/usr/ports
  46. zfs create -o compression=off   -o exec=off     -o setuid=off   zroot/usr/ports/distfiles
  47. zfs create -o compression=off   -o exec=off     -o setuid=off   zroot/usr/ports/packages
  48.  
  49. zfs create -o compression=lzjb  -o exec=off     -o setuid=off   zroot/usr/src
  50. zfs create -o compression=lzjb                                  zroot/usr/obj
  51.  
  52. zfs create                                                      zroot/var
  53. zfs create                      -o exec=off     -o setuid=off   zroot/var/db
  54. zfs create -o compression=lzjb  -o exec=on      -o setuid=off   zroot/var/db/pkg
  55. zfs create -o compression=lzjb  -o exec=off     -o setuid=off   zroot/var/log
  56. zfs create -o compression=gzip  -o exec=off     -o setuid=off   zroot/var/mail
  57.  
  58. zfs unmount -f -a
  59.  
  60. zpool export zroot
  61. zpool import -o cachefile=/tmp/zpool.cache zroot
  62.  
  63. echo "*** install FreeBSD ***"
  64.  
  65. cd /mnt/usr ; ln -s ../home home
  66. cd /usr/freebsd-dist
  67. export DESTDIR=/mnt
  68. for file in base.txz lib32.txz kernel.txz doc.txz; \
  69. do (cat $file | tar --unlink -xpJf - -C ${DESTDIR:-/}); done
  70.  
  71. cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache
  72.  
  73. echo "*** create config files ***"
  74.  
  75. cat << EOF > /mnt/etc/rc.conf
  76. zfs_enable="YES"
  77. hostname="temp"
  78. EOF
  79.  
  80. cat << EOF > /mnt/boot/loader.conf
  81. zfs_load="YES"
  82. vfs.root.mountfrom="zfs:zroot"
  83. tmpfs_load="YES"
  84. EOF
  85.  
  86. cat << EOF > /mnt/etc/fstab
  87. # Device     Mountpoint FStype  Options                 Dump    Pass#
  88. tmpfs        /tmp       tmpfs   rw,size=1024000000      0       0
  89. EOF
  90.  
  91. echo "*** create zfs mount points ***"
  92.  
  93.  
  94. cd /
  95. zfs unmount -a
  96. zfs set mountpoint=legacy zroot
  97. zfs set mountpoint=/usr zroot/usr
  98. zfs set mountpoint=/var zroot/var
  99. zfs set mountpoint=/home zroot/home
clone this paste RAW Paste Data