# Strange boot problem



## Dies_Irae (Jun 5, 2013)

Hi all,

I have FreeBSD 9.1-STABLE installed on a single UFS disk, and I'm trying to "transfer" the whole system on a mirrored ZFS pool, but I can't get the system to boot.

My plan was to boot the system from the UFS disk, create the ZFS pool, transfer the whole system to the ZFS pool, configure the "cloned" system and reboot using the mirror. Nothing exotic.

The mirror is made of 2 different-sized disks (ada1 and ada2, ada0 is the UFS disk), so the mirror size is equal to the size of the smaller disk:


```
gpart destroy -F ada1
gpart destroy -F ada2
gpart create -s gpt ada1
gpart create -s gpt ada2
gpart add -t freebsd-boot -l boot1 -b 40 -s 512K ada1
gpart add -t freebsd-boot -l boot2 -b 40 -s 512K ada2
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada2

# zfs partition on smaller disk, use whole disk
gpart add -t freebsd-zfs -a 1m -l zmirror1 ada1

# get partition size
PSIZE=`gpart show ada1 | grep 'freebsd-zfs' | awk -F ' ' '{print $2;}'`

# use this size to create an identical partition on the larger disk
gpart add -t freebsd-zfs -a 1m -l zmirror2 -s $PSIZE ada2

# remaining space will be used in the future
```

Perfect. Now I create the ZFS pool:


```
zpool create -o altroot=/mnt -o cachefile=/tmp/zpool.cache zroot mirror /dev/gpt/zmirror*
zfs set mountpoint=none
zfs set checksum=fletcher4
zfs set atime=off
zfs create zroot/ROOT
zfs create -o mountpoint=/ zroot/ROOT/default
zpool set bootfs=zroot/ROOT/default zroot
```

Works like a charm. The mirrored ZFS pool is up and running. Next, I have transfered the whole system using tar, blanked fstab and removed the vfs.root.mountfrom line from loader.conf. Just to be sure, I have created a script that verifies that every file on the UFS disk also exists in the ZFS pool, then I rebooted the machine (removing the UFS disk).

System boots fine, until "Trying to mount root from zfs:zroot/ROOT/default" where it simply stops doing anything. No errors, no warnings, no sign of life. If I press Ctrl-Alt-Del the system reboots nicely, if I push the power button the system shuts down nicely, but nothing else.

I've tried any combination of options I am aware of: using/not using vs.root.mountfrom and/or zpool.cache, changing mountpoint to legacy, installing system directly in zroot, adding ZFS entries to fstab, same result.

Anyone have had a similar problem (and maybe has solved it?)


----------



## t1066 (Jun 5, 2013)

Maybe you just forgot to run `# zpool set bootfs=zroot/ROOT/default zroot`


----------



## Dies_Irae (Jun 5, 2013)

Indeed, I've done it. I just forgot to insert it into the post! :r
Thank you for pointing out my mistake, I will correct it.


----------

