# ZFS on /usr - mounting problems



## eydaimon (Jun 5, 2009)

Hi, I've just converted my /usr directory to be ZFS.

I did this in single user mode:


cp -Rvp /usr/ /somewhere_else/
zpool add /dev/device_usr_was_on  base
umount /usr
zfs create -o mountpoint=/usr base/usr
cp -Rvp /somewhere_else/ /usr/

After reboot I'd forgotten to remove /usr/ from /etc/fstab, so I did that first thing.

Then it looked like I had the import/export issue. so I tried booting into single user mode again, and then did a zpool export on base.

However, now when I try to boot the system, /usr is still not found, and the system hangs with gtty messages, and other messages about commands not being found (uname etc) are shown first.

I have zfs_load="YES" in /boot/loader.conf
and I have zfs_enable="YES in /etc/rc.conf

I've also been using ZFS on /tmp and /var successfully for over a year now.

Why isn't my /usr being mounted?  Any help is appriciated.


----------



## graudeejs (Jun 5, 2009)

do you have recent enough /boot/zfs/zpool.cache?

can you boot in single user mode (fixit disk is alternative)
from single user mode you can do zpool import if nessacery

also check if base is mounted on root (if you use UFS-root)

you need to provide a little more info on your File system setup (are you sing ZFS only, what pools do you have, what fs are ufs etc) , otherwise i can only guess


----------



## eydaimon (Jun 5, 2009)

killasmurf86 said:
			
		

> do you have recent enough /boot/zfs/zpool.cache?



I saw talk about this on the ZFSonRoot wiki. I looked at the file, but I couldn't tell of a way to make sure if it's "recent" besides the timestamp:

```
-rw-r--r--  1 root  wheel   3.9K Jun  4 10:55 /boot/zfs/zpool.cache
```



			
				killasmurf86 said:
			
		

> can you boot in single user mode (fixit disk is alternative)
> from single user mode you can do zpool import if nessacery


Yes, that's how I have the system running now. Boot to single user, mount manually, then exit and have the boot process continue.



			
				killasmurf86 said:
			
		

> also check if base is mounted on root (if you use UFS-root)
> 
> you need to provide a little more info on your File system setup (are you sing ZFS only, what pools do you have, what fs are ufs etc) , otherwise i can only guess





> $ mount
> /dev/ad0s1a on / (ufs, local)
> devfs on /dev (devfs, local)
> base/tmp on /tmp (zfs, local)
> ...



Sorry, I tried to provide all I could think of with the first post, and I missed this. let me know if there's anything else that would help.


----------



## graudeejs (Jun 5, 2009)

to be 100% sure your zpool.cache is recent, you can export and import pools in single user mode.....

(sorry, i can't think of anything else atm, I haven't been sleeping for ~24h)


EDIT:
about that recent thing:
if you import pool in fixitcd and don't copy zpool.cache to your /boot/zfs there will be problems on boot (because you need to import zpool)

I'm not sure if simply using zpool export would help in single user mode (haven't tested)


----------



## eydaimon (Jun 5, 2009)

killasmurf86 said:
			
		

> to be 100% sure your zpool.cache is recent, you can export and import pools in single user mode.....
> 
> (sorry, i can't think of anything else atm, I haven't been sleeping for ~24h)



I did that already, not to make sure the cache was up to date, but just to make sure the system wasn't getting this message while I was booting.

i.e. I tried booting, it failed. I booted into single user, I imported with -f (otherwise I get that message), then I exported again, reboot. Fail.

Sounds like you should sleep, then come back and solve my problem


----------



## graudeejs (Jun 5, 2009)

No, don't export after you import.... 

P.S.
i'm helping my GF to write diploma

EDIT:
you only Export when you want to move pool to different OS (that includes Fixit CD)
Export can be avoided by copying zpool.cache (in some cases)


----------



## phoenix (Jun 5, 2009)

This is one of the reasons I keep / and /usr on UFS, and put everything else (/home, /var, /usr/src, /usr/obj, /usr/ports, /usr/local, /tmp) onto ZFS.  If things go south, you can always boot to single-user mode and have access to the full FreeBSD OS.  

What happens if you boot to single-user mode and:

```
# mount -u /
# /etc/rc.d/hostid start
# /etc/rc.d/zfs start
```

If the ZFS line errors out, check the output of `# zpool status` to see if the zpool is listed.  If it is, you can try to force the import using `# zpool -f import base`


----------



## eydaimon (Jun 6, 2009)

SOLVED!

I had actually tried doing something to get the hostid set correctly, I think I ran into it before, but I thought I did something differently to set the host.

Thanks much for the /etc/rc.d/hostid start

and thanks everyone who helped. I appreciate the time you put in to responding.


----------

