df -h, du -ahx and flash size not match
Hello List
I have a linux box with debian 5, kernel 2.6.27, running over a nand flash with two partitions
cat /proc/mtd
dev: size erasesize name
mtd0: 04000000 00020000 "Partition 1"
mtd1: 1c000000 00020000 "Partition 2"
The Partition 2 is my ROOTFS where I have ubifs. The size of this partition is 0x1c000000=469762048 bytes
My ubinfo output is this
ubinfo -a
UBI version: 1 Count of UBI devices: 1 UBI control device major/minor: 10:63 Present UBI devices: ubi0
ubi0:
Volumes count: 1 Logical eraseblock size: 129024 Total amount of logical eraseblocks: 3583 (462292992 bytes, 440.9 MiB) Amount of available logical eraseblocks: 0 (0 bytes) Maximum count of volumes 128 Count of bad physical eraseblocks: 1 Count of reserved physical eraseblocks: 35 Current maximum erase counter value: 33 Minimum input/output unit size: 2048 bytes Character device major/minor: 253:0 Present volumes: 0
Volume ID: 0 (on ubi0) Type: dynamic Alignment: 1 Size: 3544 LEBs (457261056 bytes, 436.1 MiB) State: OK Name: rootfs Character device major/minor: 253:1
Like you can see I have 3544 LEBS to work = 457261056 bytes
Well my question is that if I run a df -h commnad I get this output df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 30M 0 30M 0% /lib/init/rw udev 10M 48K 10M 1% /dev tmpfs 30M 4.0K 30M 1% /dev/shm rootfs 236M 161M 75M 69% / /tmp 30M 0 30M 0% /tmp
Why only 236M???
If I create big files and I run du -ahx command over / I get a total of 593M
of info
Why the size not match ? why I can have 593M in my ROOTFS if I only have 469762048 bytes?? Why df -h report 161M used in rootfs if du report 593M?
Could you help me to understand this?
Thank you !!!
Quoted 5 lines · Esteban Lopez
If I create big files and I run du -ahx command over / I get a total of 593M
of info
Why the size not match ? why I can have 593M in my ROOTFS if I only have 469762048 bytes?? Why df -h report 161M used in rootfs if du report 593M?
http://www.linux-mtd.infradead.org/faq/ubifs.html#L_df_report
I read the UBIFS FAQ and UBIFS documentation but all the explanation is about free space. I don't understand why df -h reports 236M of total space if I have 469762048 bytes in this partition.
rootfs 236M 138M 98M 59% /
cat /proc/mtd
dev: size erasesize name
mtd0: 04000000 00020000 "Partition 1"
mtd1: 1c000000 00020000 "Partition 2"
Sorry if this is a obvious answer but I will apreciate your help to understand
Quoted 8 lines · Brian Norris
Quoted 5 lines · Esteban Lopez
If I create big files and I run du -ahx command over / I get a total of 593M
of info
Why the size not match ? why I can have 593M in my ROOTFS if I only have 469762048 bytes?? Why df -h report 161M used in rootfs if du report 593M?http://www.linux-mtd.infradead.org/faq/ubifs.html#L_df_report
Quoted 3 lines · Esteban Lopez
I read the UBIFS FAQ and UBIFS documentation but all the explanation is about free space. I don't understand why df -h reports 236M of total space if I have 469762048 bytes in this partition.
I think it is also around the same set of issues. Because we do not in advance what kind of data the FS will be holding and how it is written, we do not really know how much data can fit to the FS. So UBIFS makes pessimistic calculations and reports its size as the absolutely minimum amount of space which it can fit in the worst case scenario. So in your case UBIFS decides that in the worst case it can fit a 236M file of uncompressible data (e.g., a movie).
This is kind of a compromise. Imagine UBIFS reported 500MiB free space, then you write a 300MiB AVI movie, and it does not fit. So we prefer to report the absolute minimum.
Signature · 2 lines
Best Regards, Artem Bityutskiy
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Esteban Lopez
Hello Brian
After re read the link and make some test I found that -c option in my mkfs.ubi command was the reason because I had 236M in total space. I modified this parameter from 2048 to 3570 and now I have a volume of 400 MiB
Now is clear for me how interpreted the df and du output.
Thank you for your help!!!!
You're welcome for the small pointer :)
BTW, when you are corresponding with people on mailing lists, it's good practice to Reply-All. That way, you CC the mailing list and others can see if/how you fixed your problems.
Brian
I got it!!! Thank you again
Quoted 19 lines · Brian Norris
Quoted 10 lines · Esteban Lopez
Hello Brian
After re read the link and make some test I found that -c option in my mkfs.ubi command was the reason because I had 236M in total space. I modified this parameter from 2048 to 3570 and now I have a volume of 400 MiB
Now is clear for me how interpreted the df and du output.
Thank you for your help!!!!
You're welcome for the small pointer :)
BTW, when you are corresponding with people on mailing lists, it's good practice to Reply-All. That way, you CC the mailing list and others can see if/how you fixed your problems.
Brian