On 05/12/13 23:36, Charles Manning wrote:
>
>
>
> On Fri, Dec 6, 2013 at 9:30 AM, Dominic Raferd
> <dominic@timedicer.co.uk <mailto:dominic@timedicer.co.uk>> wrote:
>
> On 05/12/13 18:46, Charles Manning wrote:
>
> On Friday 06 December 2013 01:27:09 Dominic Raferd wrote:
>
> I am responsible for a PBX system which uses embedded
> uClinux on 256MB
> internal memory disk, this uses YAFFS2 filesystem and it
> is rapidly running
> out of memory. df used space is 240MB (96% of total) and
> du used space is
> 76MB. Once df gets to 100% used I guess the whole system
> will fail and be
> irrecoverable. I don't understand much about YAFFS but
> here is some info:
>
> root@G-124:~# cat /proc/yaffs
> YAFFS built:Apr 22 2010 11:02:12
> $Id: yaffs_fs.c,v 1.89 2009-11-29 21:50:10 charles Exp $
> $Id: yaffs_guts.c,v 1.98 2009-12-07 01:17:33 charles Exp $
>
>
> Device 0 "file system"
> startBlock......... 0
> endBlock........... 1951
> totalBytesPerChunk. 2048
> nDataBytesPerChunk. 2048
> chunkGroupBits..... 0
> chunkGroupSize..... 1
> nErasedBlocks...... 63
> nReservedBlocks.... 5
> blocksInCheckpoint. 0
> nTnodesCreated..... 97500
> nFreeTnodes........ 41
> nObjectsCreated.... 96700
> nFreeObjects....... 92
> nFreeChunks........ 8822
> nPageWrites........ 8033
> nPageReads......... 89169
> nBlockErasures..... 180
> nGCCopies.......... 4471
> garbageCollections. 72
> passiveGCs......... 0
> nRetriedWrites..... 0
> nShortOpCaches..... 10
> nRetireBlocks...... 0
> eccFixed........... 0
> eccUnfixed......... 0
> tagsEccFixed....... 0
> tagsEccUnfixed..... 0
> cacheHits.......... 20
> nDeletedFiles...... 0
> nUnlinkedFiles..... 56
> nBackgroudDeletions 0
> useNANDECC......... 1
> noTagsECC.......... 0
> isYaffs2........... 1
> inbandTags......... 0
> emptyLostAndFound.. 0
> disableLazyLoad.... 0
>
> (The mounting memory loss may be related to frequent
> power cuts. Is there
> anything that can be done to recover the lost memory
> (currently 164MB)
> before the system fails entirely?
>
> I would be very grateful for some urgent help/input, and
> can pay something
> for a positive resolution. (The PBX box also has an
> attached USB drive
> (8GB) but although this is working fine I don't believe
> the system can boot
> from here, and it has no local interface, only via ethernet.)
>
> Hello Dominic
>
> If you have a wide disparity between du and df this typically
> means that you
> have lots of small files.
>
> du just adds up file contents and such to estimate space used
> with no
> knowledge of file system layout. It makes various guesses. df
> asks the file
> system what space is in use so that is a more accurate value.
>
> If you store a 1-byte file in Yaffs you will end up with:
> 1x object header chunk + 1x data chunk = 2 chunks = 4k on your
> system.
>
> However that overhead is fixed, so if you have a 1MB file, it
> just takes up
> 1MB + 1x object header chunk = 1MB + 2048 bytes.
>
> So... what are you storing that you can get rid of?
>
>
>
> Thanks for the response Charles. But there are very few small
> files in this system. If I mount this boot device at
> /tmp/mnt/mtdblock1:
> # find /tmp/mnt/mtdblock1 -size -10c|wc -l
> 87
> # find /tmp/mnt/mtdblock1 -size -100c|wc -l
> 281
>
>
>
> I only used the 1-byte file as an extreme example for illustration.
>
> Your system has 2k pages. If you have 1k files then each will be using
> 4k of space.
> If you have 2.5k files, then each will be using 6 k of space.
>
> The overhead goes down as the file size goes up.
>
> What does find give you for file sizes of 1000, 2000, 4000?
>
> -- Charles
>
Thanks again for your response.
root@G-124:~# find /tmp/mnt/mtdblock1 -size -1000c|wc -l
518
root@G-124:~# find /tmp/mnt/mtdblock1 -size -2000c|wc -l
784
root@G-124:~# find /tmp/mnt/mtdblock1 -size -4000c|wc -l
1095
root@G-124:~# find /tmp/mnt/mtdblock1|wc -l
1599
But one curious thing is that there is now a little more space available
than there was before (99% full -> 97% full). In case this is because of
something that YAFFS has been doing I give the now-current yaffs file:
root@G-124:~# cat /proc/yaffs
YAFFS built:Apr 22 2010 11:02:12
$Id: yaffs_fs.c,v 1.89 2009-11-29 21:50:10 charles Exp $
$Id: yaffs_guts.c,v 1.98 2009-12-07 01:17:33 charles Exp $
Device 0 "file system"
startBlock......... 0
endBlock........... 1951
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 63
nReservedBlocks.... 5
blocksInCheckpoint. 0
nTnodesCreated..... 97900
nFreeTnodes........ 346
nObjectsCreated.... 96700
nFreeObjects....... 104
nFreeChunks........ 7339
nPageWrites........ 367200
nPageReads......... 2186391
nBlockErasures..... 5792
nGCCopies.......... 338725
garbageCollections. 5681
passiveGCs......... 2
nRetriedWrites..... 0
nShortOpCaches..... 10
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 0
cacheHits.......... 3412
nDeletedFiles...... 0
nUnlinkedFiles..... 1130
nBackgroudDeletions 0
useNANDECC......... 1
noTagsECC.......... 0
isYaffs2........... 1
inbandTags......... 0
emptyLostAndFound.. 0
disableLazyLoad.... 0