Solved [Solved] ZFS not mounting correctly on boot

I have a zpool called tank on FreeBSD 10.0. When I was creating it I played with various vdev layouts before choosing one, and also called them tank.

When I boot, it seems to load the filesystem from a previous layout. I don't know how or why it is doing this. ls /tank shows a file that I created with dd when testing the layouts.

I try zpool import tank and it says it's already imported. If I zpool status, it looks correct. If I export then import, the correct filesystem appears.

I tried destroying the pool, zeroing the first megabyte of each disk and then creating the pool again, but it didn't help.

I added this to my /etc/fstab and it seems to work
Code:
tank    /tank   zfs     rw      0       0

However, I'm worried that this is not a good solution and also that if it does mount the incorrect filesystem and then it gets written to, it will damage the filesystem I actually want.

Is there a better way to fix this?
 
Re: ZFS not mounting correctly on boot

If it works by adding the entry to fstab, are you sure you just aren't missing the following from /etc/rc.conf?

Code:
zfs_enable="YES"

Without that it won't mount ZFS file systems on boot. It may be that the file you see on boot is actually in a /tank directory on your root file system, not on the pool at all.
 
Re: ZFS not mounting correctly on boot

Thanks, that worked.

/tank was not on the root filesystem though. It had created an empty directory on the local filesystem as a mount point, but I exported the "fake" pool and deleted that directory then rebooted and the fake pool was back again, with the test file from dd() in it.
 
Back
Top