vfs.root.mountfrom hammer?

Michael Neumann mneumann at ntecs.de
Sun Jul 27 05:43:11 PDT 2008


Matthew Dillon schrieb:
:Hi,
:
:I'm trying to mount a hammer filesystem as root via vfs.root.mountfrom.
:I tried some simple patches to make it work, but I still get panics. Is 
:it any harder than calling VFS_MOUNT for the hammer filesystem?
:
:That would allow to have a small partition with /boot on it, and the 
:rest would be loaded from the hammer partition.
:
:Regards,
:
:   Michael

    A root mount wil call mount with a NULL path and NULL data
    pointer.  I think it would be fairly easy to adjust HAMMER to
    deal with that.
    You can look at the UFS code as an example.  Look at 
    /usr/src/sys/vfs/ufs/ffs_vfsops.c starting on line 151.
  
The following patch works perfectly:

http://leaf.dragonflybsd.org/~mneumann/hammer-rootmount.diff

It isn't possible to use more than one volume, but I think thats a minor 
problem for a hammer root mount.

I'm also not quite sure where this line

	mp->mnt_flag &= ~MNT_RDONLY; /* mount R/W */

best belongs to. Right now it has the effect that every hammer root mount
is read/write. I'm also not 100% sure if I did it right to create the root vnode 
(which is required in hammer_install_volume, otherwise nlookup seems to fail).

Feel free to fix/commit it.

For those that want to try out the patch, you have to add a line to /boot/loader.conf:

 vfs.root.mountfrom="hammer:ad4s1d"

And change that ad4s1d to your hammer partition.

This partition will be mounted as "/". For the boot loader you still need the
ad4s1a partition where "/boot/*" , "/kernel" and "/modules/*" reside. So you 
may want to boot ad4s1a as /bootdir and "ln -s /bootdir/boot /boot".

This is btw more or less exactly how one can use ZFS as root mount:

 http://wiki.freebsd.org/ZFSOnRoot

Regards,

 Michael






More information about the Kernel mailing list