Initramfs/tmpfs and df issue.

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to


I have an issue with the df command and my initramfs.

First let me explain my system boot process (could be related to a bad stuff
I did, anyway any suggestions are welcome):

Linux kernel 2.6.11 with 99% drivers compiled as module as I try to keep my
kernel as small as possible (still not enough):

# ls -la /boot/Kernel-2.6.11

-rw-r--r--    1 root     root       764463 Mar  3 00:30 Kernel-2.6.11

Then I have created my initramfs cpio archive with all the stuff I need:

/bin and /sbin for some binaries (busybox, udev).

/libs for the .so of the bins above

# ls -la  /dev

drwxr-xr-x    2 root     root         4096 Jan 30 18:14 .

drwxr-xr-x    6 root     root         4096 Apr 27 18:36 ..

crw--w--w-    1 root     tty        5,   1 Jan 20 09:11 console

brw-rw----    1 root     disk       3,   0 Jan 21 12:35 hda

brw-rw----    1 root     disk       3,   1 Jan 21 12:35 hda1

brw-rw----    1 root     disk       3,   2 Jan 20 10:10 hda2

brw-rw----    1 root     disk       1,   0 Jan 20 10:10 ram0

And a /init program which :

mount /proc and /sys

create and populate the rootfs with some applications./.

and launch /sbin/init at the end to finalize the job.

My grub bootloader menu/lst look like :

title  INITRAMFS 2.6.11

root (hd0,1)

kernel   /boot/Kernel-2.6.11 ramdisk_size32%768  root=/dev/ram0 rw idebus33%

initrd    /boot/Initramfs

Then my system boot and run without any problem, except the df command !!!

Busybox df (same with an other bin) do not work on my tmpfs mount point :

# df

Filesystem           1k-blocks      Used Available Use% Mounted on

/opt has been populated but df do not see anything :

# df /opt

Filesystem           1k-blocks      Used Available Use% Mounted on

tmpfs                        0         0         0   0% /opt

Here is my /etc/fstab :

proc            /proc           proc    defaults        0       0

tmpfs           /var            tmpfs   size64%m        0       0

tmpfs           /tmp            tmpfs   size32%m        0       0

tmpfs           /opt            tmpfs   size64%m        0       0

sysfs           /sys            sysfs   defaults        0       0

If I mount an ext2 FS from the HDD then if work fine:

# df

Filesystem           1k-blocks      Used Available Use% Mounted on

/dev/hda2             62959208   5026040  54735032   8% /mnt

I do not have a /etc/mtab file but it is the same if I create one within the
initramfs init prog, same also if I create a link (/etc/mtab ->

Here are the results of mount and cat /proc/mounts :

# mount

none on /proc type proc (rw,nodiratime)

none on /sys type sysfs (rw)

none on /dev type ramfs (rw)

tmpfs on /tmp type tmpfs (rw)

tmpfs on /var type tmpfs (rw)

tmpfs on /opt type tmpfs (rw)

# cat /proc/mounts

rootfs / rootfs rw 0 0

none /proc proc rw,nodiratime 0 0

none /sys sysfs rw 0 0

none /dev ramfs rw 0 0

tmpfs /tmp tmpfs rw 0 0

tmpfs /var tmpfs rw 0 0

tmpfs /opt tmpfs rw 0 0

An other issue is (maybe related) if I do a mount -a it will mount the tmpfs
again and on top of the others without any complains (/proc/mounts entries
are duplicated.).

Any help or ideas will be appreciated as I my really stuck on this point :-<

Thank you.


Site Timeline