linuxfile-iofilesystemslinux-kernellinux-device-driver

Difference between reading from /dev/block/mmcblk0 and /dev/block/mmcblk0p1


Reading from /dev/block/mmcblk0 returned old data while reading from /dev/block/mmcblk0p1 gave the latest data. My question is does Linux maintain a backup if data is written to /dev/block/mmcblk0? This is because I was able to read old contents of the SD card by reading through that node.


Solution

  • The mmc sub-system in the Linux kernel registers device nodes of the format mmcblkXpY.

    Normal file I/O can be performed after mounting a device node pointing to a partition.

    Also note that unless a valid partition table is present on the /dev/mmcblkX device, there will be no subsequent /dev/mmcblkXpY nodes on the system.