# mount diskless nodes file systems

## srd

I have a diskless node PXE booting from a master node, getting it's 2.6.32-r7 kernel from a TFTP server, and pointed to an NFS'd root file system (which I want to share between multiple nodes) under a dir called /diskless on the master. So underneath /diskless on the master nodes is a complete gentooo installation which I chroot'd into and installed.

The client nodes get there pxelinux.cfg/default file which looks like ...

```

DEFAULT /bzImage

APPEND ip=dhcp ro rootfstype=nfs root=/dev/nfs nfsroot=192.168.10.10:/diskless

```

My diskless node boots the kernel and runs through the init scripts till it gets to the eth0 interface and just hanges there. But before that during the running of the init scripts, I also see messages like ...

```

Skipping /etc/mtab initialization (ro root?)

Skipping /var and /tmp initialization(ro root?)

Skipping /var/run/utmp initialization (ro root?)

```

Since the root fs is ro, I guess it can't write the files needed here, but I don't quite understand how to get around this.

My configuration uses this link ... http://en.gentoo-wiki.com/wiki/Initramfs#Kernel_Configuration ... which I've used to install initramfs, and the init file in my cpio archive (called ramfs.gz in the grub.conf below) looks like this ...

```

#!/bin/busybox sh

mount -t proc none /proc

mount -t sysfs none /sys

mount -o ro /dev/sda3 /mnt/root

umouont /proc

umount /sys

exec switch_root /mnt/root /sbin/init

```

Here is my /boot/grub/grub.conf file from the client's file system (/diskless/boot/grub/grub.conf).

```

default 0

timeout 30

title Gentoo Linux 2.6.32-r7

root (hd0,0)

kernel /boot/kernel-2.6.32-gentoo-r7

initrd /boot/ramfs.gz

```

The master's /etc/exports for all my client nodes.

```

/diskless    192.168.10.*(ro,sync,no_all_squash,no_root_squash)

```

The /etc/fstab of my client node (/diskless/etc/fstab) is as follows: (192.168.10.10 is the master)

```

192.168.10.10:/diskless  /  nfs  sync,hard,intr,ro,rsize=8192,wsize=8192 0 0

shm /dev/shm tmpfs nodev,nosuid,noexec 0 0

```

So with this, my client node boots and mounts the / fs read-only, but it has it's errors for per-machine configuration files such as /var, /tmp, per-node machine config files in /etc, and I'm not sure how to get around this. I was hoping to use a tmpfs file system for each of these areas that do not need to be persited across boots for the client nodes, but I don't know where to put this.

Any help much appreciated.

----------

## erik258

 *Quote:*   

> 
> 
> ```
> mount -o ro /dev/sda3 /mnt/root 
> ```
> ...

 

Interesting choice for diskless systems... 

The problem you're going to run into here (other than that) is that root can't be mounted R/O entirely.  You need to be able to write to /var, and what you write there must be specific to each host.  You can't really share /var.  

You don't need an initrd to mount NFS shares, but you'll probably need one if you don't want to give each host their own root share.  The other option is to set up a new share for each host, but this is lame for obvious reasons.  

Recently I've been playing with some diskless systems which I have boot up and keep their root on a ramdisk.  this gives them each a little room for runtime operations that is unique to them.   You probably will need to do this to some extent, because you don't have any other per-host storage except for the RAM in the system.  I got a 'complete' root filesystem (with some extensive trimming) down to about 30 megs (uncompressed), atop which my systems mount /lib/modules/`uname -r`to get at their modules, and /usr.  You could take this farther, also mounting /lib, /sbin, /bin, etc over the network, but you'll still need to provide the bare minimum utilities (mount, bash/busybox, etx) required to bring up the system.  You could probably get this down pretty small but it would take some fiddling.  I am also using ext2 images for my initrds; using a cpio archive rather than a filesystem should save lots of space wasted in only partially used inodes.  

You can then share the initrd between hosts, but there are other things to consider -- hostnames?  (You can take care of this problem by using DHCP to assign each their hostname) -- ssh host keys?  (you can share these but ssh will complain that the key matches a different host every time - you can also generate them per-boot but then you'll still have mismatched keys when you reboot.  -- unique configurations?  (How long until one of these generic nodes becomes unique?)  These are the reasons that I have been creating unique initrds for each node, even though it means duplicating /sbin, /bin, much of /etc, /var, etc.  a 30-meg initrd, under the circumstances, seemed like a quicker option, but I hope to move to 'layered' cpio archives in the future to cut down on ram usage and decrease all that icky duplication.  

Well, those are my thoughts.  I love netbooting, so I have a lot of them, and as I said, I'm playing with it now, so i'm afraid they aren't very well organized.  Hope they help!

----------

