LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-10-2008, 06:34 AM   #1
tilman1
Member
 
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72

Rep: Reputation: 15
Mounting rootfs via nfs: Remounting rw does not work


Hello

Objective:
==========
I am setting up an embedded computer as diskless host.
It boots the linux kernel via pxe. Root file system is
to be supplied via nfs.

Question
========
What do I need to do to have the client mount rootfs via nfs read write as part of the startup sequence ?

What works and what does not work ?
====================================
- pxe boots the linux kernel
- the kernel mounts the nfs file system as read only
- init is started
- linux is booted properly, i.e. no kernel panic because rootfs is not available or something alike
- init start an rc script -- remouting the rootfs read-write apparently does not work. Once I am logged in, and trying to touch a file, I get a message saying that the file system is mounted read only
- if I issue mount command to remount the rootfs read-write from the shell, it works. The rootfs is then remounted read write.

Setup
=====
1) server:
----------
- gentoo linux
- kernel 2.6.18-gentoo
- nfsd
- dhcpd
- tftp started via xinetd

2) client:
----------
- booting via pxe
- I use busybox 1.10 as shell


Config Files
============

1) dhcpd.conf:
--------------
...
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.40 192.168.1.60;
option broadcast-address 192.168.1.255;
option routers 192.168.1.2;
server-name "ztron.home.test.net";
next-server 192.168.1.1;
option root-path "192.168.1.1:/var/nfs/ts5600"; # NFS Root Path for the client
option tftp-server-name "192.168.1.1"; # This is if the TFTP server is located on a different server than DHCP
filename "/bootImage.nbi";
}

# this is the node I want to boot diskless
host vmic7750 {
hardware ethernet 00:20:38:00:67:c0;
option root-path "192.168.1.1:/var/nfs/vmic7750";
option tftp-server-name "ztron.test.gloetzner.net";
filename "/pxelinux.0";
}

2) exports
----------
# /etc/exports: NFS file systems being exported. See exports(5).
/var/nfs/ts5600 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
/var/nfs/moebius 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
/var/nfs/vmic7750 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)

3) inittab of client (provided by nfs rootfs )
----------------------------------------------
::sysinit:/etc/rc
# Trap CTRL-ALT-DELETE
tty1::respawn:/sbin/getty 38400 tty1 linux
tty2::respawn:/sbin/getty 38400 tty2 linux

# Stuff to do when restarting the init process
::restart:/sbin/init

# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r

4) rc (provided by nfs rootfs )
-------------------------------
#!/bin/sh
sleep 2
echo "Mount ROOTFS RW"
mount -n -o remount,ro /
sleep 2
mount -n -o remount,rw,noatime /
echo "Mount proc FS"
mount /proc
#/bin/mount -av
echo "Set hostname"
/bin/hostname vmic
echo "start sshd"
/usr/sbin/sshd

5) fstab(provided by nfs rootfs )
---------------------------------
192.168.1.1:/var/nfs/vmic7750 / nfs rw,rsize=8192,wsize=8192,timeo=24,intr

#192.168.1.1:/var/nfs/vmic7750 / nfs rsize=8192 0 0

/proc /proc proc defaults


Client's tty output
==================
<boot sequence output>
...
VFS: Mounted root (nfs filessystem) readonly
Freeing unused kernel memory: 128 k freed
Mount ROOTFS RW
mount: cannot read /proc/mounts: No such file or directoy
mount: cannot read /proc/mounts: No such file or directoy
Mount proc FS
Set hostname
start sshd
Net: Registered protocol family 1

vmic login:


LogFile
=======
Apr 10 12:11:25 ztron dhcpd: DHCPDISCOVER from 00:20:38:00:67:c0 via eth0
Apr 10 12:11:26 ztron dhcpd: DHCPOFFER on 192.168.1.49 to 00:20:38:00:67:c0 via eth0
Apr 10 12:11:27 ztron dhcpd: DHCPREQUEST for 192.168.1.49 (192.168.1.1) from 00:20:38:00:67:c0 via eth0
Apr 10 12:11:27 ztron dhcpd: DHCPACK on 192.168.1.49 to 00:20:38:00:67:c0 via eth0
Apr 10 10:11:27 ztron in.tftpd[10512]: RRQ from 192.168.1.49 filename /pxelinux.0
Apr 10 10:11:27 ztron in.tftpd[10512]: tftp: client does not accept options
Apr 10 10:11:27 ztron in.tftpd[10513]: RRQ from 192.168.1.49 filename /pxelinux.0
Apr 10 10:11:27 ztron in.tftpd[10514]: RRQ from 192.168.1.49 filename /pxelinux.cfg/01-00-20-38-00-67-c0
Apr 10 10:11:27 ztron in.tftpd[10515]: RRQ from 192.168.1.49 filename /bzImage.vmic7750
Apr 10 12:11:33 ztron dhcpd: DHCPREQUEST for 192.168.1.49 (192.168.1.1) from 00:20:38:00:67:c0 via eth0
Apr 10 12:11:33 ztron dhcpd: DHCPACK on 192.168.1.49 to 0:20:38:00:67:c0 via eth0
Apr 10 12:11:33 ztron rpc.mountd: authenticated mount request from 192.168.1.49:940 for /var/nfs/vmic7750 (/var/nfs/vmic7750)


Thanks
Tilman
 
Old 04-10-2008, 06:47 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
This is a total shot in the dark... but you might want to try mounting /proc before you do the remount of the nfs partition read write....
 
Old 04-10-2008, 04:09 PM   #3
tilman1
Member
 
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72

Original Poster
Rep: Reputation: 15
And it is a hit. Mounting proc first allows to remount the rootfs read-write.
Do you happen to know why that is ? Apparently, mount needs some information from the proc file system...
 
Old 04-10-2008, 05:28 PM   #4
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Ya.. /proc/mount should basically mirror the /etc/mtab file. My best guess is it can't create the /etc/mtab file because root is ro and thus it needs proc for the existing mount information to do the remount.. or something like that.
 
Old 04-10-2008, 06:18 PM   #5
tilman1
Member
 
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72

Original Poster
Rep: Reputation: 15
sounds logic and consistent...

thanks for your help

Tilman
 
Old 04-10-2008, 11:57 PM   #6
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
No problem, glad I could offer some assistance.
 
  


Reply


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
Root-NFS: Server returned error -13 while mounting /home/aravindb/RFS/rootfs boinpally Linux - Server 4 06-16-2011 07:15 AM
rootfs and etab ashlesha Linux - Newbie 0 09-20-2006 07:54 PM
NFS doesn't work work well with mounted NTFS volumes? StevenO Linux - Networking 6 02-13-2006 10:54 AM
nfs client on knoppix 3.9 - problem mounting nfs drive Rod Butcher Linux - Networking 1 09-21-2005 04:18 AM
rootfs is mounted twice! elconde Linux - General 3 11-04-2003 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

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