跳至内容
文档中心
用户工具
Login with Keycloak
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
Login with Keycloak
>
最近更改
媒体管理器
网站地图
您在这里:
index
»
jaysnote
»
flash_partition_fs
jaysnote:flash_partition_fs
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
<markdown> # flash partition fs overview ## NandFlash [nand flash](https://en.wikipedia.org/wiki/Flash_memory#NAND_memories) 对于NandFlash的认识尝试不做更多理解,只需要了解非易失存储、擦除寿命有限、通常是10K级别,同时写操作需要基于`Page`来。没有办法按照内存的存储基本单位字节来操作,由多个`Page`组成一个`Block` 每个 `Page`保留 一些字节用以 做ECC ( [error correcting code](https://en.wikipedia.org/wiki/Error_correcting_code) )校验。 通常按照如下分布。 ``` 32 pages of 512+16 bytes each for a block size (effective) of 16 KB 64 pages of 2,048+64 bytes each for a block size of 128 KB[42] 64 pages of 4,096+128 bytes each for a block size of 256 KB[43] 128 pages of 4,096+128 bytes each for a block size of 512 KB. ``` NandFlash 支持坏块管理,当上层应用通过逻辑块访问Flash的时候,驱动器控制器会把坏块重映射到好的物理块,基于此实现,FLash的一些块需要用来存储坏块信息。 或者系统会在上电时候读取出所有坏块信息存储到RAM。 绝大部分NAND 出厂就伴随着一些坏块信息,但是通常在出厂前都会进行一个坏块标记处理工序。 ## 分区 [Partitioning](https://wiki.archlinux.org/index.php/partitioning) ### 分区类型 GUIP和MBR。 #### MBR 先说MBR,很熟悉了。早些年折腾系统装机就详细了解过,区分主分区+扩展分区。因为首先分区表文件大小512字节,所以 主分区数量 m ,0<m<=4,扩展分区数量 e, 0<=e<4, 扩展分区和主分区 总共 0<e+m<=4。扩展分区可以增加理论上的不限制数量的逻辑分析。 #### GUID GUID 分区是 基于 [Unified Extensible Firmware Interface](https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface) 规范实现,通过GUID或UUID方式实现分区类型。 ### 分区原理 多个分区方便我们选择不同的文件系统和挂载选项(只读、读写) ## 文件系统 [An introduction to Linux filesystems](https://opensource.com/life/16/10/introduction-linux-filesystems) [An introduction to Linux's EXT4 filesystem](https://opensource.com/article/17/5/introduction-ext4-filesystem) ### 功能 对于文件系统的叫法,我们需要区分场景。 1. 整个linux 下面的正的/ 目录; 2. 指定数据存储的格式,例如,`EXT3, EXT4, BTRFS, XFS`。每种数据文件系统类型定义自己的 `metadata` 元数据以及如何存储和读写数据。 3. 被挂载指定linux 文件系统已经被格式化分区或者逻辑卷。 而对于文件的功能,包含以下: 1. 实现数据存储; 2. 命名空间(文件命名规则和组织规则); 3. 安全模式; 4. 给上层的增删擦改提供API; 5. 基于以上4点实现代码实现; ### EXT 历史 #### Minx What is an [inode](https://en.wikipedia.org/wiki/Inode)? Short for index-node, an inode is a 256-byte block on the disk and stores data about the file. This includes the file's size; the user IDs of the file's user and group owners; the file mode (i.e., the access permissions); and three timestamps specifying the time and date that: the file was last accessed, last modified, and the data in the inode was last modified.  详细可以参考 [inode pointer structure](https://en.wikipedia.org/wiki/Inode_pointer_structure)。 #### EXT4  如上,对于EXT4文件系统文件的接近都是通过 蓝色 `Directory Entry` 目录入口,其包含文件名、文件所在INode ID,改ID作为文件在文件系统的唯一标志符,作为文件INode 元数据的入口。 > 尽管INode的指针数据是唯一的,但是也只是相对该分区的文件系统。 如上绿部分作为INode 元数据,描述文件用户、文件类型、文件接近时间、文件大小等信息。 黄色部分描述文件的有效数据信息,包含数据位置和大小。保留15个数据块,其中12个直接描述文件数据指针,3个间接INode。我们通过可以12个直接数据块指针指定定位到文件数据位置。3个直接数据块其实描述的是iNode数据,我们需要通过这3个间接iNode数据的数据信息再定位到直接数据指针。之所以这样设计,使我们在使用文件系统过程中无可避免产生文件碎片化。 ### 文件系统修复 [Check and Repair Your Filesystem With fsck [Linux]](https://www.maketecheasier.com/check-repair-filesystem-fsck-linux/) 对于文件系统的损坏和损毁(corrupted or damage),我们应该做周期性的文件系统检查。 ### FSDebug [debugfs Command Examples](https://www.cs.montana.edu/courses/309/topics/4-disks/debugfs_example.html) ### Flash 文件系统的选择 [Flash file system](https://en.wikipedia.org/wiki/Flash_file_system) 由于Flash Page擦除的的物理特性。所以在Falsh的文件系统选择上有所有考虑。 https://www.systutorials.com/docs/linux/man/8-debugfs/) </markdown>
jaysnote/flash_partition_fs.txt
· 最后更改: 2021/06/22 23:14 (外部编辑)
页面工具
显示页面
修订记录
反向链接
回到顶部
LECONIOT
Toggle navigation
文档
博客