# Complicated mounting scheme for network booted clients

## KoichiSenada

I have some rather complicated mounting scheme for network booted clients.

Clients boot with DHCP/PXE/NFS/OpenRC and use the universal network server hosted image generated by genkernel.

It uses nfs for /root and /var/www mounting points.

It uses tmpfs for /tmp and /run mounting points.

It uses ext3 partitions labeled as home for /home mounting point.

The /etc/fstab does it as follows.

```
none                            /               none            ro                              0 0

none                            /mnt            tmpfs           nodev,nosuid                    0 0

none                            /media          tmpfs           nodev,nosuid                    0 0

proc                            /proc           proc            defaults                        0 0

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

192.168.1.1:/netboot/gentoo3    /               nfs             ro,intr,rsize=8192,wsize=8192   0 0

tmpfs                           /tmp            tmpfs           defaults,nosuid,noatime         0 0

tmpfs                           /run            tmpfs           defaults,nosuid,noatime         0 0

192.168.1.1:/var/www            /var/www        nfs             rw,nolock                       0 0

/dev/disk/by-label/home         /home           ext3            rw,nodiratime,noatime           0 0

```

And also we have there a custom mounting script in the sysinit runlevel for sys-fs/aufs3 to mix it all with tmpfs for /var and /root mounting points.

```
#!/sbin/runscript 

description="Configure system for netboot" 

depend() 

{ 

        before udev 

} 

start() { 

        einfo "netboot-mount start" 

        mount -l 

        mount -nt tmpfs -o rw none /ramdisk && einfo "mount tmpfs ramdisk" || eerror "mount tmpfs ramdisk failed" 

        for i in etc var root; do 

                mkdir /ramdisk/$i 

                mount -nt aufs -o dirs=/ramdisk/$i=rw:/$i=rr aufs /$i 

        done 

}

```

But there is a problem that clients boot without the /var/www and so we have to mount it manually each time by a special command.

```
mount 192.168.1.1:/var/www /var/www -o nolock
```

So I have a number of troubles and questions because of that.

Hopefully, someone can assist me.

1. What prevents the scheme from mounting it all by itself and how to fix it?

2. Why is there only a short output lines log in the /var/log/rc.log about the mounting and how to view the complete mounting log?

3. What happens first, parsing the /etc/fstab file or running the sysinit runlevel scripts?

4. Would that be possible to simplify the mounting scheme above and keep it just in the /etc/fstab file without the mouting script for aufs?

5. Whether does Gentoo mount the partitions twice or just once at the boot time and how to analyze it?

----------

## NeddySeagoon

KoichiSenada,

sys-init scripts run before anything else.

/etc/fstab is parsed by the localmount script

I am sure the Gentoo only mounts filesystems once as I messed up an initrd and accidently had things mounting twice.

You will notice the warnings.

What do you have in /etc/fstab  as  don't see your /var/www getting mounted anywhere.

----------

## KoichiSenada

 *NeddySeagoon wrote:*   

> KoichiSenada,
> 
> sys-init scripts run before anything else.
> 
> /etc/fstab is parsed by the localmount script
> ...

 

NeddySeagon, actually I have listed whole the content of both /etc/fstab and the mounting script above, there is nothing else inside.

And I believe I have some filesystems mounted twice or remounted or even dismounted.

But where would I notice the warnings and read the logs or at the very least pause the boot process?

Would it be possible for me to place the mounting script directives into the /etc/fstab file to make things easier and do whole the mounting in one script?

I have seen a /etc/fstab file with aufs filesystems mounted and I am wondering if I can do the same for my scheme.

Sample: Netboot setup with hybrid (ro/rw) root filesystem

----------

## KoichiSenada

How can I pause the boot process to view the console output, at least?

----------

