Migrate FreeBSD root on UFS to ZFS

At ${DAYJOB} I’m using a FreeBSD workstation for quite a while. Everything goes smoothly except for the filesystem. When I first installed it, I chose UFS because FreeBSD installer said that root-on-ZFS was “experimental”. I later learned that nobody uses UFS anymore and that root-on-ZFS is perfectly stable. Thing is, I chose UFS and I deeply regret it. Not because of ZFS‘s features that absolutely do not matter for me on the desktop, but because FreeBSD implementation of UFS is terribly, terribly slow when it comes to manipulate big files. When I say slow, I mean that pkg upgrade tends to FREEZE the entire machine while extracting archives. That slow. And before you ask, yes, there’s been a lot of tuning on that side.

I’m using that migrated disk as we speak, it’s blazing fast, no more freezes, plus I could add the old disk as a mirror using ZFS. Not bad after all.

Update

Here’s an article that explains the procedure to have a mirrored setup of the latter migration; no surprise, you’ll just have to follow the steps described before on a new disk and then attach both disks to a mirror vdev: