public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* df -h, du -ahx and flash size  not match
@ 2012-02-20 17:41 Esteban Lopez
  2012-02-20 23:47 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Esteban Lopez @ 2012-02-20 17:41 UTC (permalink / raw)
  To: linux-mtd

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 !!!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: df -h, du -ahx and flash size not match
  2012-02-20 17:41 df -h, du -ahx and flash size not match Esteban Lopez
@ 2012-02-20 23:47 ` Brian Norris
  2012-02-21  8:56   ` Esteban Lopez
       [not found]   ` <4F45FE0C.3070807@softel.net.mx>
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Norris @ 2012-02-20 23:47 UTC (permalink / raw)
  To: Esteban Lopez; +Cc: linux-mtd

On Mon, Feb 20, 2012 at 9:41 AM, Esteban Lopez <elopez@softel.net.mx> wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: df -h, du -ahx and flash size not match
  2012-02-20 23:47 ` Brian Norris
@ 2012-02-21  8:56   ` Esteban Lopez
  2012-03-07 17:30     ` Artem Bityutskiy
       [not found]   ` <4F45FE0C.3070807@softel.net.mx>
  1 sibling, 1 reply; 6+ messages in thread
From: Esteban Lopez @ 2012-02-21  8:56 UTC (permalink / raw)
  To: linux-mtd

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


El 02/20/2012 11:47 PM, Brian Norris escribió:
> On Mon, Feb 20, 2012 at 9:41 AM, Esteban Lopez<elopez@softel.net.mx>  wrote:
>> 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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: df -h, du -ahx and flash size not match
  2012-02-23 19:35     ` Brian Norris
@ 2012-02-23 16:52       ` Esteban Lopez
  0 siblings, 0 replies; 6+ messages in thread
From: Esteban Lopez @ 2012-02-23 16:52 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

I got it!!! Thank you again


El 02/23/2012 07:35 PM, Brian Norris escribió:
> On Thu, Feb 23, 2012 at 12:51 AM, Esteban Lopez<elopez@softel.net.mx>  wrote:
>> 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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: df -h, du -ahx and flash size not match
       [not found]   ` <4F45FE0C.3070807@softel.net.mx>
@ 2012-02-23 19:35     ` Brian Norris
  2012-02-23 16:52       ` Esteban Lopez
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2012-02-23 19:35 UTC (permalink / raw)
  To: Esteban Lopez, linux-mtd

On Thu, Feb 23, 2012 at 12:51 AM, Esteban Lopez <elopez@softel.net.mx> wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: df -h, du -ahx and flash size not match
  2012-02-21  8:56   ` Esteban Lopez
@ 2012-03-07 17:30     ` Artem Bityutskiy
  0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2012-03-07 17:30 UTC (permalink / raw)
  To: Esteban Lopez; +Cc: linux-mtd

On Tue, 2012-02-21 at 08:56 +0000, Esteban Lopez wrote:
> 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.

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-07 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 17:41 df -h, du -ahx and flash size not match Esteban Lopez
2012-02-20 23:47 ` Brian Norris
2012-02-21  8:56   ` Esteban Lopez
2012-03-07 17:30     ` Artem Bityutskiy
     [not found]   ` <4F45FE0C.3070807@softel.net.mx>
2012-02-23 19:35     ` Brian Norris
2012-02-23 16:52       ` Esteban Lopez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox