zfs mounting

dbi

Active Member

Thanks: 7
Messages: 129

#1
Hi,

I've managed to build a zfs-only system with 8.0-RC by following a few articles [1],[2] on the Internet. The system boots, mounts the root zfs volume in read-only mode and goes in single user.
At this point I do:
Code:
zfs mount -a ; exit
...and then everything works as expected.


Following [2.14] I've issued:

Code:
Fixit# zfs set mountpoint=legacy zroot
Fixit# zfs set mountpoint=/tmp zroot/tmp
Fixit# zfs set mountpoint=/usr zroot/usr
Fixit# zfs set mountpoint=/var zroot/var
before the first reboot.

Is this enough to make it mount all data sets automatically?


[1] http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/
[2] http://wiki.freebsd.org/ZFSOnRootWithZFSboot
 
OP
OP
D

dbi

Active Member

Thanks: 7
Messages: 129

#3
Yes, I've got that enabled. A work around is to put all but root datasets in /etc/fstab. This way everything gets mounted, but I believe using fstab shouldn't be necessary. Am I wrong?
 

avilla@

Well-Known Member
Developer

Thanks: 58
Messages: 258

#4
you're correct
/etc/fstab needs to be filled in if you're using "legacy" for the mountpoint property (as the name says), otherwise the filesystems will be mounted automatically
 
OP
OP
D

dbi

Active Member

Thanks: 7
Messages: 129

#5
So, is there a way to have zfs-only system with an empty fstab (besides "special" cases like procfs and entries for CD/DVD and so on)?
 

Andrius

Member

Thanks: 6
Messages: 38

#6
Yes, add vfs.root.mountfrom="zfs:zroot" to /boot/loader.conf
That is, assuming your root folder is "zroot", otherwise use "zfs:zroot/root" or whatever.
 
OP
OP
D

dbi

Active Member

Thanks: 7
Messages: 129

#8
Andrius said:
Yes, add vfs.root.mountfrom="zfs:zroot" to /boot/loader.conf
That is, assuming your root folder is "zroot", otherwise use "zfs:zroot/root" or whatever.
That is the problem. I have that exact line. FBSD mounts "zroot on / (zfs,local,ro)" and waits for admin actions (single user). Then I press enter to get /bin/sh as shell, issue "zfs mount -a ; ctrl+d" and the system continues the boot process as expected.
All that if there are no zfs enties in fstab. If I have the zfs entries in fstab the system works as expected.
 
OP
OP
D

dbi

Active Member

Thanks: 7
Messages: 129

#10
jb_fvwm2 said:
BTW that freebsdish link is down or gone. If you've
saved it locally you can maybe summarize it somewhere...
A google cache copy is still available at:
http://209.85.129.132/search?q=cach...+site:blogs.freebsdish.org+setting-up-a-zfs-o

I'm not sure if it is legal to CC the contents of the page w/o authors permission here, so I'll summarise only the commands I've used from there:
Code:
gpart create -s GPT ad4
gpart add -b 34 -s 128 -t freebsd-boot ad4
gpart add -b 162 -s 5242880 -t freebsd-swap ad4
gpart add -b 5243042 -s 125829120 -t freebsd-zfs ad4
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad4
And reviewing both articles, I believe I've found my mistake. I missed the command:

Code:
zpool set bootfs=zroot zroot
Now I have set this property and I'll report if it was the problem on the next boot.

//APPEND:
Unfortunately, that's not the problem.
Here are my zfs lines from fstab and my zroot properies:
Code:
root@bsd ~ # grep zfs /etc/fstab    
# zroot                           /                         zfs     rw      0       0
zroot/usr                       /usr                      zfs     rw      0       0
zroot/home                      /home                     zfs     rw      0       0
zroot/usr/ports                 /usr/ports                zfs     rw      0       0
zroot/usr/ports/distfiles       /usr/ports/distfiles      zfs     rw      0       0
zroot/usr/ports/packages        /usr/ports/packages       zfs     rw      0       0
zroot/usr/src                   /usr/src                  zfs     rw      0       0
zroot/var                       /var                      zfs     rw      0       0
zroot/var/crash                 /var/crash                zfs     rw      0       0
zroot/var/db                    /var/db                   zfs     rw      0       0
zroot/var/db/pkg                /var/db/pkg               zfs     rw      0       0
zroot/var/empty                 /var/empty                zfs     rw      0       0
zroot/var/log                   /var/log                  zfs     rw      0       0
zroot/var/mail                  /var/mail                 zfs     rw      0       0
zroot/var/run                   /var/run                  zfs     rw      0       0
zroot/var/tmp                   /var/tmp                  zfs     rw      0       0
zroot/tmp                       /tmp                      zfs     rw      0       0
zroot/home/ccache               /home/ccache              zfs     rw      0       0
root@bsd ~ # zpool get all zroot                                            (09-28 01:19)
NAME   PROPERTY       VALUE       SOURCE
zroot  size           464G        -
zroot  used           18,5G       -
zroot  available      445G        -
zroot  capacity       3%          -
zroot  altroot        -           default
zroot  health         ONLINE      -
zroot  guid           3059349396238082607  -
zroot  version        13          default
zroot  bootfs         zroot       local
zroot  delegation     on          default
zroot  autoreplace    off         default
zroot  cachefile      -           default
zroot  failmode       wait        default
zroot  listsnapshots  off         default
root@bsd ~ #
This way it works. If I remove the fstab lines it goes to single user with zroot mounted on / and waits for intervention.
 

krynn

New Member

Thanks: 1
Messages: 6

#11
what does your '/boot/loader.conf' look like, cause I followed a lot of the exact same instructions that you did and I have mine booting without anything in my /etc/fstab (aside from my tmpfs mounts). Also when you originally did your base install on the Fixit CD you were sure to recompile the boot loader with ZFS support yes? Besides the obvious 'zfs_load="YES"' is the 'vfs.root.mountfrom="zfs:zroot"' line.
 

Andrius

Member

Thanks: 6
Messages: 38

#12
dbi, I asked "what else do you have in fstab" and grep'ing zfs is pretty much the opposite of what I wanted to know. If you have some other filesystem like linprocfs, it will try to mount before zfs automagically mounts itself ant therefore fail, because there's no place for it to be mounted yet. It may be similar with other filesystems, so in case you do have more entries in fstab that automounts something on boot, try adding "noauto" option and see if it boots properly.
 

avilla@

Well-Known Member
Developer

Thanks: 58
Messages: 258

#13
for linprocfs adding "late" to options is enough, at least for me (/compat is a link to /usr/local/compat):

Code:
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/cd0                /cdrom          cd9660  ro,noauto       0       0
proc                    /proc           procfs  rw              0       0
linproc         /compat/linux/proc      linprocfs       rw,late 0       0
 
OP
OP
D

dbi

Active Member

Thanks: 7
Messages: 129

#14
Sorry, I missed the "else" part in your question.
Here it is:

Code:
/dev/mirror/dataf /home/data            ufs     rw,async                2       0


/dev/acd0       /cdrom                  cd9660          ro,noauto       0       0

proc            /proc                   procfs          rw              0       0
linproc         /compat/linux/proc      linprocfs       rw              0       0

You, guys, were correct - I have no "late" option in my fstab. I've just added it and I'll write if it helped upon reboot.
 
Top