Waitman Gobble XMPP wago@ee.smq.io irc://irc.y0m4m4.com/waitman,isnick

2021-03-15 5:30 pm

Convert a UFS drive to ZFS

FreeBSD 13.0 R2 is out. Release due end of the month. It's a great improvement from 12. I finally upgraded my UFS laptop to GELI encrypted ZFS root. Time to get with the program!

It was an easy process.

  1. freebsd-update upgrade -r 13.0-R2
  2. pkg update && pkg upgrade
  3. rsync -av /boot, /etc, /var /root and /usr/local to another drive
  4. If you have /usr/home on a separate drive, read below. Otherwise rsync /usr/home to other drive.
  5. If you store files in weird places you ought not to then you need to copy or move those to another drive.
  6. If you installed Linux on your machine rsync /compat to storage drive
  7. Download 13.0-R2 memstick image and dd to USB stick
  8. Boot memstick and install FreeBSD 13.0-R2 selecting auto ZFS and the GELI encrypt option in the menu
  9. Boot into new system and cat saved boot/loader.conf to /boot/loader.conf (append with >> !!!!!)
  10. Merge new /etc/fstab with old /etc/fstab, you want the new entries for system disk but also other mounts you may have had.
  11. Rsync your saved /usr/local and /root (and /compat if you have Linux) back to new system
  12. Rsync your saved /var back to new system
  13. Rsync your saved /etc back to new system. Make sure that /etc/fstab is the new merged file.
  14. Add enable_zfs="YES" to your /etc/rc.conf
  15. Rsync back your /boot/modules/ contents to the new /boot/modules
  16. If you rsynced your home directory your have to put it back on the new system.

Reboot into new system.

FreeBSD 13.0-RC2 Now Available


Adding another drive -> read https://www.cyberciti.biz/faq/how-to-add-encrypted-zfs-pool-on-freebsd-server/

I noticed an issue. If you create a new zpool named "home" it will magically mount this to your home directory. Here's a weird thing though, for some reason I had an actual directory /home instead of a symlink /home -> /usr/home - this was a new install. Normally I would never do such a thing as create /home. So I'm not sure why.

Here's the problem this caused: I had 100GB of files in my home directory and i put these in a backup /usr/home/backup. When I booted into multi-user mode, /usr/home was empty but the drive use showed the 100GB were on the drive. mounting my "home" zpool put it on /home. /usr/home remained empty. Booting into single user mode /usr/home had the backup files. But the drive is mounted read-only. As soon as I mounted the drive read-write the files disappeared again, /usr/home was empty. So I could live with my home directory in /home/waitman and I had the backup on a USB drive so nothing was lost, but it was still using up 100GB on the drive for nothing. I noticed that /home was a directory and not a symlink, when I deleted the directory and made a symlink the backup files in /usr/home reappeared and I could delete them and free up 100GB of space. Mounting the home zpool now mounts to /usr/home where it should be, and the /home now symlinks to /usr/home. So that was a nutty thing but it's resolved.

Copyright 2021 Waitman Gobble. Contact