Linux 从 /dev/block/mmcblk0 和 /dev/block/mmcblk0p1 读取的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12366515/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:18:56  来源:igfitidea点击:

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

linuxfile-iofilesystemslinux-kernellinux-device-driver

提问by spitfire88

Reading from /dev/block/mmcblk0 returned old data while reading from /dev/block/mmcblk0p1 gave latest data. My question is does linux maintain a back up 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.

从 /dev/block/mmcblk0 读取返回旧数据,而从 /dev/block/mmcblk0p1 读取返回最新数据。我的问题是,如果数据写入/dev/block/mmcblk0,linux 是否会保持备份?这是因为我能够通过读取该节点来读取 SD 卡的旧内容。

采纳答案by TheCodeArtist

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

Linux 内核中的 mmc 子系统注册格式为mmcblkXpY.

  • Each mmc device registered within the Linux kernel receives it own mmc device number X.
  • Each partition on a particular device receives it own number Y
  • 在 Linux 内核中注册的每个 mmc 设备都会收到它自己的 mmc 设备编号X
  • 特定设备上的每个分区都有自己的编号Y

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

挂载指向分区的设备节点后,即可进行正常的文件I/O。

Also note that unless a valid partition table is present on the /dev/mmcblkXdevice, there will be no subsequent /dev/mmcblkXpYnodes on the system.

另请注意,除非/dev/mmcblkX设备上存在有效的分区表,否则/dev/mmcblkXpY系统上不会有后续节点。