df and /mnt/initfs confusion Re: N800 Disk Full? Erratic Behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James Sparenberg wrote:
> On Sunday 28 October 2007 10:04:02 Peter Bart wrote:
> 
> Ok rundown one section at a time. 
>> /home/user # cd /
>> / # df -h
>> Filesystem                Size      Used Available Use% Mounted on
>> /dev/mtdblock4            2.0M      2.0M         0 100% /mnt/initfs
> this will always be at 100% as it's a compressed FS that you don't write too. 
> (it's what is flashed) No matter how large/small initfs is it's by design 
> always 100% since it's both a file and a file system.  

Well, true that full initfs is no problem. But no, it is not by design 
100% full no matter what size. In recent firmwares it is 100% full 
because it is simply filled up with data. If you install bootmenu and 
let it to remove unneeded stuff from initfs it won't be full anymore and 
you can write to it. Also if you manage to change partition layout and 
enlarge initfs then it won't be full even with unmodified initfs image. 
My 770 has initfs partition 5MB big (byproduct of dangerous experiments 
in the past) and is filled to 45% (2.3MB full).

>> none                    512.0k     68.0k    444.0k  13% /mnt/initfs/tmp
> tmp is a little heavy but OK ..... No real problem.  this is again part of the 
> initfs so it's actuall the same as /tmp .... confusing perhaps but it's 
> related to this being an embeded device not a standard computer. 


/tmp is mounted as a tmpfs filesystem i.e. is only backed by RAM and on 
reboot (or unmount) everything is lost. It is limited to 512KB by mount 
parameter in initfs. On nokia tablets it is meant to be small so if it 
is full it is caused by some ill-behaved application and it may cause 
problems at runtime. Every reboot clears it.

The confusion behind /tmp and / being 'mirrored' as /mnt/initfs and 
/mnt/initfs/tmp in df output stems from the fact that:

- system boots from initfs (i.e. real / points to initfs partition at 
boot time), then /tmp and /proc is mounted (still in initfs) and only 
later the main rootfs is mounted (flash or mmc or whatever) and root 
mountpoint is swapped with it and old one is moved to /mnt/initfs. This 
is done by command pivot_root http://www.google.com/search?q=pivot_root

- in new root /tmp is mounted again to the same tmp as in initfs (via 
mount -o bind) mainly because there are two unix sockets related to 
communication with dsme and bme daemons (which were started at the time 
when initfs was real root)

Also the first line
/dev/mtdblock4            2.0M      2.0M         0 100% /mnt/initfs
is in fact wrong, the first column should be /dev/mtdblock3. df command 
is either somehow confused by the root swapping magic or by /etc/fstab 
file which contains line starting with /dev/root which is now different 
then it was at early boot time. For equally confusing but a bit more 
correct info you can see also output of 'cat /proc/mounts'

I hope this explains that df output a bit. For normal user this really 
doesn't matter :-)

Frantisek


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Big List of Linux Books]    

  Powered by Linux