# PXE Booting with root on NFS4

## NeddySeagoon

Team,

I've had my diskless media player working well, pxe booting over NFS3 ... so far so good.

In the interests of being first into the future rather than last out of the past, I've been trying to move to NFS4.

Everything works except mounting root. If I revert root to nfs3 and leave everythig else (portage and the media exports) as ntf4 all is well.

So, what do I need in /boot/pxelinux.cfg/default to mount root using nfs4 and why?

Google has let me down - lots of hits for root over nfs but it all looks like nfs3.

----------

## gerdesj

Not much detail ...

A quick Google for 

```
pxelinux nfs4
```

 finds this, which specifically mentions NFS4:

http://doc.gabosh.net/howto_Thinclient_Basesystem.html

http://doc.gabosh.net/howto_Server_for_thinclients.html

I haven't read it in detail though.

and this:

https://wiki.archlinux.org/index.php/Diskless_network_boot_NFS_root

and this:

http://ubuntuforums.org/showthread.php?t=1019932

Cheers

Jon

----------

## NeddySeagoon

gerdesj,

Thanks for your help.

The first link shows pxe booting with nfs version 4 using an initrd, so you can call userspace mount to mount root as nfs4.

The others use nfs3.

I really wanted to avoid an initrd if I could. I should have said that in my first post.

----------

## logistiker

After some exhausting searching on the internet, here's what I found:

Several websites mentioned that the kernel does not support nfsv4 as a nfs root filesystem.   It would be nice to know why this support doesn't exist since it seems several people have asked this question.  I can confirm that it works fine when booting as nfsv2 or nfsv3, although I would make sure to specify nfsv3 (nfsvers=3 in the pxe boot config) because nfsv2 does not support large file sizes (several gigabytes).

Many people have claimed that they can get nfsv4 to mount as a root file system but it seems every claim has mentioned the use of initrd in the pxe config.  It would be nice to have some explanation on how to set up an initrd to mount nfsv4 as a root filesystem though.  Can anyone post here what steps involved are for that?

----------

## NeddySeagoon

logistiker,

When time permits I shall try the initrd route. I suspect its much like mounting root on LVM over raid.

The big questing going the initrd is does busybox support NFS4 mounts or will I need a static mount.

I'm not in any hurry. It appears the the 3.3-rcX kernel no longer read my my wireless Logitech unity keyboard, so I can have a mediaplayer that does sound over HDMI with the radeon driver but no keyboard, or I can have the keyboard but must use the binary blob to get sound over HDMI.  I'm short of time to play too.

----------

## richard.scott

Hi NeddySeagoon,

You've helped me lots in the past so I thought I'd jump in.

If you use Genkernel to help make your initrd and PXE Boot then don't use a version greater than v3.4.18 as it won't mount the squashfs image via NFS when you PXE boot.

See here for others having the same problem: https://forums.gentoo.org/viewtopic-t-912898-highlight-.html

You need to cache the CD image in RAM on the client incase you loose all network connectivity to the NFS server... this way your node doesn't just die.

Rich

----------

## NeddySeagoon

richard.scott,

Thank you.  Right now I have a bigger problem with my media server and need to fix that before I play with NFS4 and PXE boot

Everything in the system in LVM over raid5. I have two drives with in the raid with bad blocks on bit in different places. The means the raid is servicable and all the information is there but I can't drop a drive out to replace it without losing data, since I won't have a complete degraded raid set to work with.

I need to fix that first.  The data thats affected is my DVD collection, so its expendable. Its just the time to stuff the DVDs back in.

----------

## VoVaN

I'm using PXE boot for quite a while. Currently I'm using NFS3, but, as I can remember, I've been able to mount NFS4 using standard busybox mount. Please post about the progress with this NFS4 issue.

BTW, I'm using aufs with NFS rw root (on per node basis) over shared NFS ro root, so I can provide up-to-date/working busybox config and simple init script. The total uncompressed size of initramfs is ~1,5Mb and compressed with LZMA ~0,5Mb. Success!

----------

## NeddySeagoon

VoVaN,

I've swapped out one dead drive in the process of avoiding reripping 1200 DVDs. The second is RMAed and I'm waiting for the replacement to arrive.

It will be at least two more weekends before I can play with root on NFS4 again.

I've not given up but I don't want to do anything I don't have to on a raid set with no redundent data.

----------

## dacid

Just curious if anyone got pxe boot working without initrd?

----------

## iomarian

am trying to pxe boot a gentoo live cd ; i am having some trouble in succiding; so far i found 2 methods to boot but none does the job; 

first option 

KERNEL gentoox86/x86_gentoo_install.kernel

append root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs  cdroot initrd=gentoox86/gentooo.igz vga=791 doload=nls_cp437,nls_iso8859-1

 Afer loading the gentoo kernel and gentoo initrd, system boots and afer asking for keyboard map it display Media not found; not bootable medium found, waiting for new device. 

second option 

KERNEL gentoox86/x86_gentoo_install.kernel

APPEND ip=dhcp root=/dev/nfs rootfstype=nfs nfsroot=IP:/path-to-shared rootpath=/path-to-shared 

in the second option i get kernel panic

Can someone help me ?

----------

## szatox

LINUX gentoo/kernel-genkernel-x86-3.7.10-gentoo

APPEND ip=dhcp root=/dev/ram0 cdroot=1 real_root=/dev/nfs nfsroot=<IP>:<path to directory containing squashfs> initrd=<initrd filename> loop=<squashfs filename> looptype=squashfs

AFAIR path following 'initrd=' is in relation to pxelinux.0

----------

## iomarian

now i get :

mount : mounting IP:/path to gentoo on /mn/cdrom failed: Input/output error 

!! NFS Mounting failed. Is the path correct ?

>> Determining looptype ...

!! Invalid loop location : gentoo/image.squashfs

MENU LABEL ^Gentoo x86

KERNEL gentoox86/x86_gentoo_install.kernel

APPEND ip=dhcp root=/dev/ram0 cdroot=1 real_root=/dev/nfs nfsroot=IP:/pxe/share/gentoox86 initrd=/gentoox86/x86_gentoo_install.initrd loop=gentoox86/image.squashfs looptype=squashfs

i don't understant the AFFAIR entry

----------

## krinn

 *NeddySeagoon wrote:*   

> 
> 
> I've swapped out one dead drive in the process of avoiding reripping 1200 DVDs. The second is RMAed and I'm waiting for the replacement to arrive.
> 
> It will be at least two more weekends before I can play with root on NFS4 again.
> ...

 

From experience, RMA drives are refurbish ones, and expect it to die in few months. (yeah, even if they change it again, they keep eating your warranty months on each try, upto the point your drive is again dead but no more under warranty).

Alas, you better buy a new drive and reuse the RMAed one as a spare.

----------

## NeddySeagoon

iomarian,

Please share your tftp server file layout.

----------

## iomarian

cat /etc/default/tftpd-hpa 

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/pxe/tftpboot"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="--secure"

----------

## NeddySeagoon

iomarian,

Join #gentoo-releng on irc.freenode.net

The gentoo guys that make the liveCDs can be found there.  They can help if anyone can.

----------

