pxeboot and /boot filesystem, share /boot/kernel

Bernd Walter ticso at cicely12.cicely.de
Sun Jul 1 22:55:32 UTC 2007


On Sun, Jul 01, 2007 at 05:35:40PM -0400, Martin Cracauer wrote:
> Bernd Walter wrote on Sun, Jul 01, 2007 at 09:36:41PM +0200: 
> > On Sun, Jul 01, 2007 at 02:13:34PM -0400, Martin Cracauer wrote:
> > 4) Use different / on the same server filesystem with hardlinked /boot.
> 
> Hmm, directory hardlinks through NFS server? But might do.

I ment the files in it hardlinked.

> I also considered hacking up the NFS server code to resolve individual
> symlinks of my choice.  I like this feature a lot when serving samba
> shares to Windows clients to make stupid applications actually place
> stuff where I want it.  But this solution is bad news if you rebase
> your NFS server.

Yes - too easy to forget.

> %%
> 
> It has been pointed out to me that BSD used to have
> /etc/fstab.<hostname> back in the day.  That seems to be easy enough
> to re-introduce given that pxeboot already set the IP address.
> 
> However, it is somewhat hackey since in effect your first root
> filesystem (common for all clients) gets used only once for /etc/fstab
> and is only used to redirect to a new (indivual) root filesystem.

I have something quite similar with a bunch of NetBSD hosts.
Common / with different var partitions mounted by custom scripts and
not by fstab.
Since hostname was already set by dhcp at this point it worked.

> > 5) Use two / - one common for booting and a client specific.
> >    loader.rc in common will overwrite rootfs.
> >    But I'm unshure if you can get host specific data, e.g. MAC from net
> >    interface.
> 
> That is somewhat similar to /etc/fstab.<host> but would require the
> 4th to know about networking.

It does know the bootdev and I just checked the soruce and it even sets
variables:
common/dev_net.c:    setenv("boot.netif.ip", inet_ntoa(myip), 1);
common/dev_net.c:    setenv("boot.netif.netmask", intoa(netmask), 1);
common/dev_net.c:    setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
common/dev_net.c:    setenv("boot.netif.hwaddr", temp, 1);
common/dev_net.c:    setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
common/dev_net.c:    setenv("boot.nfsroot.path", rootpath, 1);

No hostname, but IP and MAC.
You just have to use the variables in your own loader.rc to overwrite
the path.
You can fetch them with getenv:
s" boot.netif.ip" getenv
Well - my forth is too rusty, so I can't help on the if/setenv part.

> > 6) Don't install *.symbols and live with multiple file space usage for
> >    the rest.
> 
> Right but not sportish :-)

:-)

> Overall, I also need to keep in mind that some but but all of my
> diskless clients will have individual kernels and that I want the most
> elegant way to express this.  

If you want you can select the kernel in your loader.rc as well...

> Or a per-host kernel setting in loader.rc which normally points to the
> common kernel but can point to an individual one.  But as mentioned
> earlier, this is difficult to do if you / is already unshared, unless
> the loader can deal with NFS or tftp to load from a
> address:/boot/... location. 

It can at least read any file from the already mounted NFS path.
No problem to read /boot/kernel.hostx/ instead of default.
Don't know if you can switch to another NFS path.

-- 
B.Walter                http://www.bwct.de      http://www.fizon.de
bernd at bwct.de           info at bwct.de            support at fizon.de


More information about the freebsd-hackers mailing list