[Techtalk] checking mounts

Sarah Newman newmans at sonic.net
Sun Sep 27 02:55:09 UTC 2009



Miriam English wrote:
> Hi Joana,
> 
> Damn! I knew about mtab, yet I spent hours trying various other things. 
> Amazing how the human mind can get tunnel-vision. :)
> It occurs to me that mtab could be prone to the same name problems as 
> those that Sarah pointed out for the mount command in her reply.

Well, actually it's all screwed up.

This is a dump of data from different sources. From boot to now no 
devices have physically been added or removed:

# mount
rootfs on / type rootfs (rw)
/dev/root on /mnt/initfs type jffs2 (ro)
none on /mnt/initfs/proc type proc (rw)
none on /mnt/initfs/sys type sysfs (rw)
none on /mnt/initfs/tmp type tmpfs (rw)
/dev/mmcblk0p2 on / type ext3 (rw,noatime,data=ordered)
none on /tmp type tmpfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
none on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
/dev/mmcblk1p1 on /media/mmc1 type vfat 
(rw,nosuid,nodev,uid=29999,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,utf8)

#df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/mmcblk1p2            4.0M      2.3M      1.7M  57% /mnt/initfs
none                    512.0k    116.0k    396.0k  23% /mnt/initfs/tmp
/dev/mmcblk0p2          472.8M    341.2M    107.2M  76% /
none                    512.0k    116.0k    9   396.0k  23% /tmp
none                      1.0M     60.0k 64.0k   6% /dev
tmpfs                     1.0M         0      1.0M   0% /dev/shm
/dev/mmcblk1p1            6.9G      4.7G      2.2G  69% /media/mmc1



#cat /proc/partitions
major minor  #blocks  name

   31     0        128 mtdblock0
   31     1        384 mtdblock1
   31     2       2048 mtdblock2
   31     3       4096 mtdblock3
   31     4     255488 mtdblock4
  254     0    7864320 mmcblk0
  254     1    7239264 mmcblk0p1
  254     2     500024 mmcblk0p2
  254     3     125024 mmcblk0p3

# ls /dev/mmcblk*
/dev/mmcblk1    /dev/mmcblk1p1  /dev/mmcblk1p2  /dev/mmcblk1p3


----

Discrepancies from boot to "now":

'/mnt/initfs' is actually mounted on /dev/mtdblock3

What was 'mmcblk0' at boot is now called 'mmcblk1' .

--
I haven't looked at the entire boot process to know exactly where these 
come in, but anyway point being that for a partition mounted during 
boot, the partition name shown may not match the current name of the 
partition.

For example this device has two mmc slots. Normally there is the mmc 0 
slot and the mmc 1 slot.  The device booted off of the card in the mmc 1 
slot.  So presumably when the device booted, the boot mmc device is 
called mmcblk0. Later it was changed to be called mmcblk1 as it is 
during normal operation.

As to the mtdblock3 being called mmcblk1p2 -- /dev/mtdblock3 was the 
original root. Then pivot_root was called and moved the old root to 
/mnt/initfs and the new root to the boot mmc partition. At the time that 
was called mmcblk0p2, but as mentioned above that device is now called 
mmcblk1.

The current root is mounted on what is now called /dev/mmcblk1p2. So I 
guess confusion between the old root and the new root is what's causing 
/mnt/initfs to show as being mounted on /dev/mmcblk1p2.

As to the rhyme or reason of where these programs get their information, 
I don't know.  Obviously some of it is kernel level given the 
information from /proc/partitions, but probably not all of it. It also 
seems that nothing expects the file to device mapping to change without 
the device being removed.

Realize I have a 2.6.21 kernel and probably hacked together init scripts 
so YMMV.

Bleah.

--Sarah


More information about the Techtalk mailing list