文件系统ext3的文件大小限制

来源:互联网 发布:免费机械三维软件 编辑:程序博客网 时间:2024/05/18 03:36

http://www.aslibra.com/blog/post/ext3_single_file_size_limit.php

想解决缓存的性能问题,准备选用BerkeleyDB作为存储方式,但会有单个文件的问题。

BerkeleyDB的性能没有问题的,DB库非常紧凑,不超过500K,但可以管理大至256T的数据量。

操作系统能够达到多少的单个文件的,对于ext3系统,是根据格式化时选择的blocksize来决定的:

引用
Filesystem File Size Limit Filesystem Size Limit 
ext2/ext3 with 1 KiB blocksize 16448 MiB (~ 16 GiB) 2048 GiB (= 2 TiB) 
ext2/3 with 2 KiB blocksize 256 GiB 8192 GiB (= 8 TiB) 
ext2/3 with 4 KiB blocksize 2048 GiB (= 2 TiB) 8192 GiB (= 8 TiB) 
ext2/3 with 8 KiB blocksize (Systems with 8 KiB pages like Alpha only) 65568 GiB (~ 64 TiB) 32768 GiB (= 32 TiB)

参考:http://www.suse.de/~aj/linux_lfs.html

也就是说,ext3系统对应的单个文件限制为:
1k 16G
2k 256G
4k 2T

我们怎么知道现在的分区是多大的blocksize呢?
一般而言,格式化时会自动选择一个合适的文件大小的,硬盘大则会选4k,很小的则选择1k的。


在正常的硬盘(600G)上:
[root@aslibra ~]# dumpe2fs /dev/sda3
dumpe2fs 1.35 (28-Feb-2004)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          8b556c99-cbe6-48f2-bbfe-fea1969e2557
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode filetype needs_recovery sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              87785472
Block count:              175546271
Reserved block count:     8777313
Free blocks:              37366602
Free inodes:              74134440
First block:              0
Block size:               4096

虚拟机上分配的硬盘(7G)比较小:
[root@aslibra /]# dumpe2fs /dev/sda1
....
Block size:               1024


也就是说,基本上单个文件可以用完整个硬盘,空间不用太担心。

有兴趣看更多的文件格式比较:
http://en.wikipedia.org/wiki/Comparison_of_file_systems

原创粉丝点击