Discovering current MTD partition

Ricard Wanderlof ricard.wanderlof at axis.com
Thu Apr 28 03:39:00 EDT 2011


On Thu, 28 Apr 2011, Iwo Mergler wrote:

>> This will give me the same info as /proc/mtab.  I cannot figure out how I
>> can infer which /dev/mtdXX was booted from with this information.
>>
>
> Here is an example from the embedded system I have on my desk
> right now:
>
> root:/proc# cat /proc/mounts
> rootfs / rootfs rw 0 0
> mtd:rfs / jffs2 rw,relatime 0 0
> proc /proc proc rw,relatime 0 0
> devpts /dev/pts devpts rw,relatime,mode=600 0 0
> etc.

On the other hand, here's another example from a system on my desk:

# cat  /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / jffs2 rw,relatime 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
udev /dev tmpfs rw,relatime 0 0
tmpfs /dev/shm tmpfs rw,relatime 0 0
/dev/part/rwfsblock /mnt/flash jffs2 rw,relatime 0 0
tmpfs /var tmpfs rw,relatime 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0

The root partition is just listed as /dev/root without any information 
about what that refers to. The system doesn't even have a /dev/root so 
it's just some sort of placeholder.

On the other hand, on the same system, df says:

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock3           28672     22384      6288  78% /
udev                     66588         4     66584   0% /dev
tmpfs                    66588         0     66588   0% /dev/shm
/dev/part/rwfsblock     228864      5456    223408   2% /mnt/flash
tmpfs                    66588     25660     40928  39% /var

which tells exactly where the root file system is. Don't know exactly how 
it obtains the information though.

The system is running busybox so a quick look in the code for the df 
command should explain how its done.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the linux-mtd mailing list