Migrating from UFS to ZFS

Here is my plan to move from UFS single drive to ZFS mirror.

The server has two drives of equal specifications. The second drive is currently holding backups and is formatted to UFS. So something like this.
  1. Remove data of second drive, move backups elsewhere etc.
  2. Create a partition to hold the ZFS data on the second drive, not using maximum capacity of the drive. Probably around 80-90%.
  3. Create a zpool and filesets on the drive. The ones created would hold all files except root files, this won't be a ZFS on root.
  4. Reboot the server into some kind of recovery mode eg. mfsBSD.
  5. Whilst in offline recovery transfer all non root partition files to the ZFS drive. (Not sure of best command to use here to preserve perms etc.)
  6. Configure loader.conf for ZFS.
  7. Configure fstab for ZFS.
  8. Reboot into ZFS system with root still being UFS.
Reasons for not doing ZFS on root is the restrictions of not been able to expand pool, add cache/log devices. But lose a redundant root/boot. Is there a way to duplicate UFS root to the second drive, even if manual?

At this stage is a problem that I wouldn't be able to put ZFS on the first drive without wiping the existing root partition?

So an alternative plan would be to also transfer root files to the second HDD along with other files making that HDD the new boot device which gives freedom to convert the first drive so it can be used in a ZFS mirror.
 
You think you can create a snapshot of the UFS root drive, but you cannot do it directly: with a LiveCD.

Start the LiveCD, when prompted for actions, choose LiveCD. When prompted for a user name use `root'. Let's say that the old root partition is /dev/ada0s2. So you run # fsck -t ufs -y /dev/ada0s2, and then you can mount it with # mount -t ufs /dev/ada0s2 /mnt. Now you can create the snapshot of your mounted filesystem, as it is described in this HOW-TO.

WARNING: On different machines, the file devices might have different names, so it's probable, that you'll have to fix the /etc/fstab afterwards, and that you'll have to reinstall the boot loader (well, boot is on a different partition to begin with).

Another thing you can do, is just use the UFS backup utilities, like dump(8)() and restore(8)(). See this HOW-TO.
 
Make full, tested backups first.

Are you sure about the limitations of root on ZFS? I'd either go all ZFS or a gmirror(8) for the operating system on a separate pair of drives.
 
Back
Top