Skip to content

Commit abbfa7d

Browse files
committed
Ext4: 部分特性
1 parent 10ad079 commit abbfa7d

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| |-- solutions
2222
| | `-- 现代操作系统.md
2323
| |-- Effective-Java.md
24+
| |-- FileSystem-Ext4.md
2425
| |-- unicodeStandard.md
2526
| |-- 计算机网络杂记.md
2627
| |-- 深入理解Java虚拟机.md

reading-notes/FileSystem-Ext4.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Ext4 文件系统简要总结
2+
3+
最近在看操作系统的文件系统这块,感觉只有理论还是不行,所以就选了一种文件系统作一下拓展。
4+
5+
选择 Ext4 的原因是: 他是 Linux 的主流文件系统 `ext*` 家族中最新的版本
6+
7+
主要内容:
8+
9+
1. Ext4 的特性
10+
1. Ext4 磁盘布局
11+
- Tips: 本文内容主要是 [Ext4 文档](https://ext4.wiki.kernel.org/index.php/Main_Page) 的概括翻译加上自己的解释说明,所以英文水平还行的话建议直接看英文文档。
12+
13+
本文假设读者对文件系统有基本的了解,否则请先查阅相关资料(《现代操作系统》《操作系统概念(影印版)》)
14+
15+
---
16+
17+
<!-- TOC -->
18+
19+
- [Ext4 文件系统简要总结](#ext4-文件系统简要总结)
20+
- [主要特性](#主要特性)
21+
- [兼容性(Compatibility)](#兼容性compatibility)
22+
- [更大的文件系统和文件大小(Bigger File System and File Sizes )](#更大的文件系统和文件大小bigger-file-system-and-file-sizes-)
23+
- [拓展子目录数量(Sub directory scalability )](#拓展子目录数量sub-directory-scalability-)
24+
- [拓展块大小(Extents)](#拓展块大小extents)
25+
- [多块分配(Multiblock allocation)](#多块分配multiblock-allocation)
26+
- [参考](#参考)
27+
28+
<!-- /TOC -->
29+
30+
---
31+
32+
## 主要特性
33+
34+
### 兼容性(Compatibility)
35+
36+
Ext4 兼容 Ext3,升级只需运行一些命令即可,不需要变动磁盘格式,升级中不会影响已有的数据。
37+
38+
### 更大的文件系统和文件大小(Bigger File System and File Sizes )
39+
40+
|File System| Max FS Size | Max File Size|block addressing bits|
41+
|:---:|:---:|:---:|:---:|
42+
|Ext3|16TB|2TB|32|
43+
|Ext4|1EB|16TB|48|
44+
45+
Tips:
46+
- 1 EB = 1024 * 1024 TB
47+
- block size: 4 bytes
48+
49+
### 拓展子目录数量(Sub directory scalability )
50+
51+
在一个目录中,
52+
53+
- Ext3 支持 32000 个子目录
54+
- Ext4 支持 64000 个子目录
55+
56+
### 拓展块大小(Extents)
57+
58+
### 多块分配(Multiblock allocation)
59+
60+
当需要将新数据写入磁盘上时,需要块分配器决定将数据写入哪一个空闲块中。
61+
62+
但是 Ext3 写入的时候,每次只分配一个 block(4kb), 也就是说如果要写入 100 Mb 的数据时会调用块分配器 25600 词,效率很低,分配器也无法作优化。
63+
64+
Ext4 使用多块分配器,一次调用分配多个块
65+
66+
67+
## 参考
68+
69+
1. [File system](https://en.wikipedia.org/wiki/File_system#Linux)
70+
1. [Ext4 Howto](https://ext4.wiki.kernel.org/index.php/Ext4_Howto)

0 commit comments

Comments
 (0)