2

My question should stem from my misunderstanding of ubi and MTD. However, I can't figure it out by googling (And didn't find a good tutorial).

I simply want to find out the total capacity of my Nand Flashes, so I used df -h

    Filesystem                Size      Used Available Use% Mounted on             
    ubi0:rootfs               1.8G     46.8M      1.8G   3% /                      
    devtmpfs                375.4M         0    375.4M   0% /dev                   
    tmpfs                   503.5M         0    503.5M   0% /dev/shm               
    tmpfs                   503.5M    436.0K    503.1M   0% /tmp                   
    /dev/ubi0_0               1.8G     46.8M      1.8G   3% /mnt/nand 

So far so good, It seems that my device has 2 nands: ubi0_0 and ubi0:rootfs around 4 G in total (am I right ?)

As far as I know, UBIFS is a filesytem for use on top of MTD; hence when I run mtdinfo -a, I should be able to see the mtd devices info and capacity. My problem is, I have 4 MTD devices with total capacity of in order 2 GB (mostly from mtd0). Why df -h shows me 2 * 1.8 GB but mtdinfo shows 2 GB :

# mtdinfo -a                                                                   
Count of MTD devices:           4                                              
Present MTD devices:            mtd0, mtd1, mtd2, mtd3                         
Sysfs interface supported:      yes                                            

mtd0                                                                           
Name:                           gpmi-nand                                      
Type:                           nand                                           
Eraseblock size:                524288 bytes, 512.0 KiB                        
Amount of eraseblocks:          4096 (2147483648 bytes, 2.0 GiB)               
Minimum input/output unit size: 4096 bytes                                     
Sub-page size:                  4096 bytes                                     
OOB size:                       224 bytes                                      
Character device major/minor:   90:0                                           
Bad blocks are allowed:         true                                           
Device is writable:             true                                           

mtd1                                                                           
Name:                           U-Boot                                         
Type:                           nor                                            
Eraseblock size:                65536 bytes, 64.0 KiB                          
Amount of eraseblocks:          12 (786432 bytes, 768.0 KiB)                   
Minimum input/output unit size: 1 byte                                         
Sub-page size:                  1 byte                                         
Character device major/minor:   90:2                                           
Bad blocks are allowed:         false                                          
Device is writable:             false                                          

mtd2                                                                           
Name:                           env                                            
Type:                           nor                                            
Eraseblock size:                65536 bytes, 64.0 KiB                          
Amount of eraseblocks:          1 (65536 bytes, 64.0 KiB)                      
Minimum input/output unit size: 1 byte                                         
Sub-page size:                  1 byte                                         
Character device major/minor:   90:4                                           
Bad blocks are allowed:         false                                          
Device is writable:             false                                          

mtd3                                                                           
Name:                           Kernel                                         
Type:                           nor                                            
Eraseblock size:                65536 bytes, 64.0 KiB                          
Amount of eraseblocks:          114 (7471104 bytes, 7.1 MiB)                   
Minimum input/output unit size: 1 byte                                         
Sub-page size:                  1 byte                                         
Character device major/minor:   90:6                                           
Bad blocks are allowed:         false                                          
Device is writable:             true                                           

# 
0

Your gpmi-nand device seems to be mounted twice, as / and /mnt/nand. You can verify this by creating a file in /root; it should also appear in /mnt/nand/root... So you effectively only have one 2GB partition mounted, which matches mtdinfo's output.

  • Thx. Do you know any good document/website about "MTD", "UBI", and in general how to associate them together. – Aman Feb 11 '15 at 19:39
  • I only know the UBI FAQ and Howto... – Stephen Kitt Feb 11 '15 at 22:29
  • I read it, but I need something more in depth and more understandable for rookies like me :) Thx – Aman Feb 12 '15 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.