Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
zfsonroot [2007/04/25 21:38] – Link to ZFS AndrewThompsonzfsonroot [2021/05/04 10:51] (current) – Fix 3 broken links. SashaVigole
Line 1: Line 1:
 You have an ad0 disk. Create one slice covering the entire disk: You have an ad0 disk. Create one slice covering the entire disk:
  
-<code> +''%%# fdisk -BI /dev/ad0%%''
-# fdisk -BI /dev/ad0 +
-</code>+
  
 Initialize the BSDlabel: Initialize the BSDlabel:
  
-<code> +''%%# bsdlabel -wB /dev/ad0s1%%''
-# bsdlabel -wB /dev/ad0s1 +
-</code>+
  
 Edit your label and create a small (like 256MB-512MB) 'a' partition and Edit your label and create a small (like 256MB-512MB) 'a' partition and
 use the rest for the 'd' partition: use the rest for the 'd' partition:
  
-<code> +''%%# bsdlabel -e /dev/ad0s1%%''
-# bsdlabel -e /dev/ad0s1 +
-</code>+
  
-The 'd' partition will be used for ["ZFS"]:+Something like this will create 512MB 'a' partition and allocate the rest for the 'd' partition:
  
-<code> +''%%# /dev/ad0s1:%%''\\  
-# zpool create tank ad0s1d +''%%8 partitions:%%''\\  
-</code>+''%%#     size     offset  fstype%%''\\  
 +''%%  a:  1048576  16      unused%%''\\  
 +''%%  c:  *        0       unused%%''\\  
 +''%%  d:  *        *       unused%%'' 
 + 
 +The 'd' partition will be used for [[ZFS]]: 
 + 
 +''%%# zpool create tank ad0s1d%%'' 
 + 
 +Create bootdir directory where the boot file system will be mounted: 
 + 
 +''%%# mkdir /tank/bootdir%%''\\  
 +''%%# ln -s bootdir/boot /tank/boot%%''
  
 Create a UFS file system on /dev/ad0s1a and copy the /boot/ directory onto it: Create a UFS file system on /dev/ad0s1a and copy the /boot/ directory onto it:
  
-<code> +''%%# newfs /dev/ad0s1a%%''\\  
-# newfs /dev/ad0s1a +''%%# mount /dev/ad0s1a /tank/bootdir%%''\\  
-# mount /dev/ad0s1a /mnt/tmp +''%%# cp -Rp /boot /tank/bootdir/%%''
-# cp -Rp /boot/* /mnt/tmp/ +
-</code>+
  
-Note that there is no /boot/ directory on ad0s1a yet. This is one of the +If the boot filesystem is already existing then make sure that /boot/zfs/zpool.cache still gets copied over.
-two possibilities. You now need to create a symlink:+
  
-<code> +Now don't forget to add zfs_load="YES" to /tank/boot/loader.conf.
-# cd /mnt/tmp +
-# ln -s . boot +
-</code>+
  
-From what I checked our loader should handle symlinks just fine. +Ok, you also need to tell your loader where your root file system is. 
-This will allow us to mount /dev/ad0s1a on /boot directory and use it as +You can do it by adding:
-usual.+
  
-Another option is to:+''%%vfs.root.mountfrom="zfs:tank"%%''
  
-<code> +to /tank/boot/loader.conf or you can create /tank/bootdir/etc/fstab file 
-# cp -Rp /boot /mnt/tmp/ +with one entry only:
-</code>+
  
-and in the future mount /dev/ad0s1a on eg. /bootdisk and create symlink:+''%%tank    /    zfs    rw    0    0%%''
  
-<code> +On your [[ZFS]] file system, your /etc/fstab (/tank/etc/fstab) should contains the line above and:
-# ln -s bootdisk/boot /boot +
-</code>+
  
-All in all, you should see your kernel when you do:+''%%/dev/ad0s1a    /bootdir    ufs    rw    1    1%%''
  
-<code> +(and everything else, ie. your swap and other file systems)
-# ls -l /mnt/tmp/boot/kernel +
-</code>+
  
-Now don't forget to add zfs_load="YES" to /mnt/tmp/boot/loader.conf.+At the end, set mount point to 'legacy' so [[ZFS]] won't try to mount it automatically:
  
-Ok, you also need to tell your loader where your root file system is. +''%%# zfs set mountpoint=legacy tank%%''
-You can do it by adding:+
  
-<code> +==== troubleshooting ==== 
-vfs.root.mountfrom="zfs:tank" +  * Ensure /boot/zfs/zpool.cache is up to date on the boot filesystem 
-</code>+  * Set ''%%vfs.zfs.debug=1%%'' in the loader to see more ZFS debug messages to the console
  
-to /mnt/tmp/boot/loader.conf or you can create /mnt/tmp/etc/fstab file +==== Alternate way with GPT and full zfs (no UFS /boot) for 8.0-RELEASE ====
-with one entry only:+
  
-<code> +%%FreeBSD%% 8.0 and later have support for a full zfs-based system (i.e. without using an UFS /boot), so we can use the GPT partitioning scheme along with /boot/gptzfsboot. See lulf blog's entry:
-tank /       zfs     rw      0       0 +
-</code>+
  
-On your ["ZFS"] file system, your /etc/fstab should contains the line above +[[https://web.archive.org/web/20100824022058/http://lulf.geeknest.org:80/blog/freebsd/Setting_up_a_zfs-only_system/]]
-and:+
  
-<code> +or
-/dev/ad0s1a  /boot   ufs     rw      0       0 +
-</code>+
  
-(and everything else, ie. your swap and other file systems)+[[https://www.dan.me.uk/blog/2010/02/08/booting-from-zfs-raid056-in-freebsd-8-0-release/]] 
 + 
 +==== Automated installation with GPT and full zfs for 8.0-RELEASE ==== 
 + 
 +You may try the mfsbsd SE amd64 ISO image with the "zfsinstall" script located at: http://mfsbsd.vx.sk/ 
 + 
 +==== Automated install with GPT and Full ZFS with PXE ==== 
 + 
 +PXE: [[https://web.archive.org/web/20180218111315/https://planet.freebsd.org/brd/2012/03/23/pxe-booting-freebsd-9/]] 
 + 
 +Install: [[https://web.archive.org/web/20180218111315/https://planet.freebsd.org/brd/2012/05/08/scripted-install-of-freebsd-9/]]
  
-At the end, set mount point to 'legacy' so ["ZFS"] won't try to mount it automatically:+----
  
-<code> +{{tag>Zfs}}
-# zfs set mountpoint=legacy tank +
-</code>+
  
  • zfsonroot.1177537138.txt.gz
  • Last modified: 2007/04/25 21:38
  • by AndrewThompson