PDA

Bekijk de volledige versie : df vs /etc/mtab



dolphine
27-12-2007, 11:25
Hello,

recently I have found that df is not working well as it can not find /etc/mtab

When I try to specify the volume it says that it can not find the mountpoint

Unfortunately /proc/mounts can not be symlinked to /etc/mtab as /etc/ is not writable :-(

Both /prov/mount and /opt/etc/fstab seem OK to me.

Any idea?

Thanks a lot in advance!

al37919
27-12-2007, 12:42
the reason is that alternative df is installed by some package in /opt/bin, but which one? At least df from coreutils works fine. Could you please show the output of
ls -al /opt/bin/*df


Unfortunately /proc/mounts can not be symlinked to /etc/mtab as /etc/ is not writable :-(

It is not true: /etc is writable, because it is located in ramfs. So, to save the file /etc/mtab do the following:

ln -s /proc/mounts /etc/mtab
echo "/etc/mtab" > /usr/local/.files
flashfs save && ...

dolphine
27-12-2007, 17:48
Thanks a lot!

I did not think of the the original df (/bin/df), which works fine, so I can check the space on the HDD which was the original intent.



the reason is that alternative df is installed by some package in /opt/bin, but which one? At least df from coreutils works fine. Could you please show the output of
ls -al /opt/bin/*df




[root@(none) /opt/bin]$ ls -la *df
lrwxrwxrwx 1 root users 16 Dec 27 11:07 df -> /opt/bin/busybox


I would guess that the busybox df kind of expects the mtab in /opt/etc, where it actually is.



It is not true: /etc is writable, because it is located in ramfs. So, to save the file /etc/mtab do the following:

ln -s /proc/mounts /etc/mtab
echo "/etc/mtab" > /usr/local/.files
flashfs save && ...

This is strange as I was mistaken by the fact that I can not write to /etc nor create symlink, ie:



[root@(none) /]$ ln -s /proc/mounts /etc/mtab
ln: /etc/mtab: Operation not permitted
[root@(none) /]$ echo "/etc/mtab" > /usr/local/.files
bash: /usr/local/.files: Permission denied
[root@(none) /]$ flashfs save
bash: flashfs: command not found
[root@(none) /]$


BTW: How does the ramfs works in terms of memory allocation / space?
Does it have some particualr space allocated in advance or it "dynamically" eats memory for space when needed?
The free space is not shown by df :-(

I'm thinking of moving the logs from /opt/var/log to some temporary (ramfs) place so that the HDD does not have to spin-up every time a log even is written (eg. cron every hour or so)

al37919
27-12-2007, 21:34
Oops, I'm sorry, I just realized that you have 700gE. Actually, the answer was about Oleg's fw for 500. However, fine that it has helped somehow :)


Does it have some particualr space allocated in advance or it "dynamically" eats memory for space when needed?

AFAIK, when needed (if ramfs exists in 700gE)
This is typical output of mount command on wl500gP (you can try it for your case):


/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
ramfs on /tmp type ramfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/discs/disc0/part2 on /opt type ext3 (rw,noatime)

To check memory state try: free