Red Hat Bugzilla – Bug 406711
/dev to be mounted in tmpfs, not on snapshot NFS server
Last modified: 2008-04-16 23:48:24 EDT
Description of problem:
/dev partition should be mounted in tmpfs to speedup booting of the diskless
machines. With udev, the content of /dev does not need to be placed on the
premanent storage so tmpfs is just ideal here.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
/dev is mounted in the snapshot area on the NFS server
/dev should be mounted on tmpfs
Suggesting the following (grabbed from RHEL-5 initrd):
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
Created attachment 290227 [details]
Patch against disklessrc
This patch makes a diskless workstation to mount /dev via tmpfs and thus speeds
up booting. Also solves other mystical problems.
I tried this and there was lot of errors from SElinux unable to set context on
Also, I don't see /dev mounted on tmpfs when I list mounted devices in my
Fedora. Maybe those lines in initrd are just temporary stuff?
This will need further investigation.
I was also confused about the /dev in Fedora/RHEL:
[ondrejv@deneb ~/banka]$ cd /dev
[ondrejv@deneb /dev]$ df -m .
Filesystem 1M-blocks Used Available Use% Mounted on
- 3967 1 3967 1% /dev
which tells us nothing about the filesystem.
But in the standard initrd from RHEL-5 we can see:
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
I understand it the way that /dev is mounted via tmpfs during the init boot
stage and the switchroot command switches the root filesystem while preserving
/dev as tmpfs.
The diskless setup should do the same (more or less). That's why the proposed patch.
Regarding the SELinux:
1. it is very strange as (as I said) /dev is commonly mounted via tmpfs
2. in the diskless setup must be the SELinux disabled anyway otherwise some
services like at and cron do not work well.
Yes, you are right about /dev in Fedora/RHEL5. It can even be seen as tmpfs in
mounts, I was just looking in bad place, i.e. "mount" instead of "cat
I adjusted few things and everything now work fine for me.
These changes were needed:
* remove /dev/ from diskless files
(which caused many errors due to read-only /dev -> it was still mounted from
nfs, so switch_root does not seem to preserve /dec)
* add "mount --bind /mnt/dev /dev" to disklessrc right before exec
* also it seems better to create /dev as one of first things, right after
Anyway, thanks for patch and suggestion, it is really faster now.
2 minor things:
- RHEL5 initrd uses switchroot whereas disklessrc uses pivot_root. That's
(probably) the answer to the /dev mountpoint persistence. Maybe we should use
switchroot as well? (I do not know)
- probably not all mknod's (see above in the patch) are actually necessary - I
just grabbed what I found in the rhel-5 initrd.
- agree with the rest
Many thanks for your help.
This bug is now fixed (as described above) in rawhide and the fix is going to
RHEL5 as well. I'm now backporting this and few other fixes to F8 so the report
could be closed.
Regarding the pivot_root vs switchroot: s-c-netboot uses switchroot since the
initrd to initramfs transition, so this should not be a problem.
The mknod's seem ok and work fine, so I'm letting that all here.
system-config-netboot-0.1.42-2.fc8 has been submitted as an update for Fedora 8
system-config-netboot-0.1.42-2.fc8 has been pushed to the Fedora 8 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update system-config-netboot'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-2741
Tried the both system-config-netboot-cmd-0.1.45 and
system-config-netboot-0.1.42-2 and I noticed one problem:
* Both packages now use /sbin/switch_root instead of the old pivot_root which is
only available in the newest busybox-anaconda. There is nothing wrong on it but
I am aiming to build (on RHEL-5 box) a diskless image of RHEL-4.
Busybox-anaconda for RHEL-4 does not contain switch_root :-(.
I thought system-config-netboot was supposed to be able to create a working
diskless image even from the old versions of RHEL (it still contains all the
patches for rc.sysinit and other init scripts which are now not relevant -
starting from RHEL-4 no significant changes need to be done to make diskless
So, for, me I would either propose:
* cleaning system-config-netboot from those irrelevant patches for older OSes
and state clearly that the package is supposed to make a diskless image only
from the same OS version it has been run from (+ maybe some trivial check of
or (for me better :-):
* Spend some minimal effort to make it working even with some older OSes. For
example, to make it working with RHEL-4, only 2 things are needed:
- do not complain if mount.nfs is missing (it is missing on RHEL-4)
- push some updated busybox-anaconda package into RHEL-4
Otherwise the package looks pretty good now.
system-config-netboot-0.1.42-2.fc8 has been pushed to the Fedora 8 stable repository. If problems still persist, please make note of it in this bug report.