Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-06-2008, 04:48 AM   #1
Registered: Nov 2002
Posts: 207

Rep: Reputation: 32
nfs root path variable (pxe/nfs boot)


How can I pass, either by dhcpd.conf or by kernel boot parameter, a variable that is exported in host bash.

I have a target that boots from the host but I want the root path to be 'read' by host variable. For example,

in bash:
export TARGET="/my/root/path"

Passing by kernel boot parameter
THIS DOESN'T WORK. It passed :: mount $TARGET and got kernel panic.

In dhcpd.conf the variable is set as:
option Root-Path "/my/root/path"
and I don't know how to change it here.

Or is it possible by any other means?

Old 03-07-2008, 02:08 PM   #2
Registered: Nov 2004
Location: Florida, USA
Distribution: Debian, Redhat
Posts: 417

Rep: Reputation: 53
In your dhcpd.conf file, is that option passed as a global option or as one for a specific host? If it is as a global option, you should be able to override it for an individual host in that hosts' configuration section of the dhcpd.conf file.
Old 03-07-2008, 02:29 PM   #3
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
I don't think it's possible to do what you want via an environment variable in the dhcpd.conf file. It's not interpreted as a shell script, so it won't work directly. I suppose you could have a sed script to make the changes, the restart dhcpd, but it'd be an ugly hack to say the least.

I do something similar to what you want but with symlinks for the root directory. In the config file, I've got a permanent nfs root entry as /mnt/nfsroots/currentroot. currentroot is actually a symlink to the directory I really want to export. I've got a shellscript that swaps the symlink between directories whenever I want to change filesystems. Actually, my kernel sent by tftp is a symlink too. Dead easy to test new images on my dreambox.

Why are you wanting to do this anyway?

Last edited by beadyallen; 03-07-2008 at 02:33 PM.
Old 03-11-2008, 09:19 AM   #4
Registered: Nov 2002
Posts: 207

Original Poster
Rep: Reputation: 32

I have targets that needs to run exactly the same distro but a few directories like /var /root /home needs to be different. So what I originally did was I had the distro at:

then i soft linked the whole distro to it:

/target1/distro/boot -> /tftpboot/images/boot
/target1/distro/etc -> /tftpboot/images/etc

Now I know it doesn't work... mounted by nfs doesn't allow to have symlinks on top level. But what I'm doing now that works is:

in my /tftpboot/images/distro i have copies of root like:


/root -> root_target1

The thing is that the complete distro is 1.7G and I don't want to copy it for each target.

Then when it is tested on one distro, I need to do try another distro for exact same procedure. Instead of me re-writing the dhcpd.conf or kernel parameters all the time when I'm jumping between distros, I was hoping I could do this by simple environment variable or something


Last edited by freeindy; 03-11-2008 at 09:31 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PXE boot / NFS freeindy Linux - Networking 3 03-06-2008 04:40 AM
NFS/PXE Boot on Linux Kernel kushalkoolwal Linux - Kernel 3 02-05-2008 05:46 PM
pxe nfs boot, kernel panic - portmap error davidcollins001 Linux - Networking 0 04-29-2007 12:20 PM
NFS Error during PXE Boot from NFS server JatMan Linux - Enterprise 0 10-16-2006 05:48 PM
NFS Root Boot - Exports soulkeeper Linux - Networking 3 07-24-2004 02:27 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:26 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration