Determining actual flash usage of a particular file

Artem B. Bityuckiy dedekind at yandex.ru
Fri Nov 19 04:19:32 EST 2004



jdub at us.ibm.com wrote:
> On Thu, 2004-11-18 at 14:15, 419cf994 at tempmail.wgz.org wrote:
> 
>>I've been reading through the archives for several days, so I hope I 
>>haven't missed an answer somewhere.
>>
>>Is there a way to determine the actual flash space occupied by a 
>>particular file on a JFFS2 partition?  'ls' and 'du' report number of 
>>bytes of the content of the file, but of course compression and other 
>>factors affect that greatly.
>>
>>My definition of actual space is flexible...  could be number of blocks or 
>>pages occupied, or something similar.  I just need a metric that's more 
>>closely related to storage space than uncompressed size.
> 
> 
> I don't know of a way to get this info on a running system.  If you can
> pull the binary filesystem image off of the board you might be able to
> hack jffs2dump.c in the util directory to give you that info.
> 
> Or maybe there are other ways that I don't know about.
> 
> josh

You may write some fctl which does this. In the kernel space, it is very 
easy to calculate th actual size of the file on flash (just go through 
node_refs and summ the ref->totlen).

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.




More information about the linux-mtd mailing list