您查看的文章来源于http://www.oklinux.cn
Ext3文件系统和reiserfs文件系统现在linux系统上是非常流行的两种。下面我们来比较一下这两种文件系统本身对硬盘空间的占用情况。因为我的硬盘分区已经基本定好,不轻易更改了,所以就使用文件的方式创建文件来进行比较──究竟我们这里比较的不是速度,而是空间──然而这样做不知是否和实际设备上有区别。
(一)首先,我们需要一个有足够空闲空间的分区来做这个实验。我的空闲的空间还不到5GB,所以只好把实验的每个最大分区做到2GB。我的实验中先是做100MB的“分区”的比较,然后是1GB分区的比较,最后是2GB分区的比较。我们所需要的工具也十分简单:dd工具,用于较快地取得一个大文件;创建文件的工具mkfs.ext3和mkfs.reiserfs;df工具,用来查看分区占用情况。
这里提前说明我的系统的简单情况:内核为2.6.23.1,自己编译的。命令替换有alias ll='ls -l'。reiserfs版本是3.6的。
(二)现在就开工:
1.创建100M的文件:
dd if=/dev/zero of=d-ext3fs bs=1M count=100
dd if=/dev/zero of=d-reiserfs bs=1M count=100
2.创建文件系统:
2.1创建ext3文件系统:
togry@xiaowp:~/disks$ sudo mkfs.ext3 d-ext3fs
mke2fs 1.40.4 (31-Dec-2007)
d-ext3fs is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
25688 inodes, 102400 blocks
5120 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
2.2创建reiserfs文件系统:
togry@xiaowp:~/disks$ sudo mkfs.reiserfs d-reiserfs
mkfs.reiserfs 3.6.19 (2003 www.namesys.com)
A pair of credits:
Lycos Europe (www.lycos-europe.com) had a support contract with us that
consistently came in just when we would otherwise have missed payroll, and that
they kept doubling every year. Much thanks to them.
Jeremy Fitzhardinge wrote the teahash.c code for V3. Colin Plumb also
contributed to that.
d-reiserfs is not a block special device
Use -f to force over
///////////////呵呵,不让我默认在文件上创建文件系统。
togry@xiaowp:~/disks$ sudo mkfs.reiserfs d-reiserfs -f
mkfs.reiserfs 3.6.19 (2003 www.namesys.com)
A pair of credits:
The Defense Advanced Research Projects Agency (DARPA, www.darpa.mil) is
the
primary sponsor of Reiser4. DARPA does not endorse this project; it mer
ely
sponsors it.
Jeremy Fitzhardinge wrote the teahash.c code for V3. Colin Plumb a
lso
contributed to that.
d-reiserfs is not a block special device
Continue (y/n):y
Guessing about desired format.. Kernel 2.6.23.1.build51 is running.
Format 3.6 with standard journal
Count of blocks on the device: 25600
Number of blocks consumed by mkreiserfs formatting process: 8212
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 3bb7a2da-b78a-462f-9ea0-a004171c8667
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok
Tell your friends to use a kernel based on 2.4.18 or later, and especially n
ot a
kernel based on 2.4.9, when you use reiserFS. Have fun.
ReiserFS is successfully created on d-reiserfs.
|
3.这样创建好文件系统之后,开始挂载它们,查看他们的可用空间吧。
togry@xiaowp:~/disks$ sudo mount d-ext3fs ext/ -t ext3 -o loop
togry@xiaowp:~/disks$ sudo mount d-reiserfs rei/ -t reiserfs -o loop
togry@xiaowp:~/disks$ df
文件系统 1K-块 已用 可用 已用% 挂载点
......(此处将不相干的东西略去)
/home/togry/disks/d-ext3fs
99150 5664 88366 7% /home/togry/disks/ext
/home/togry/disks/d-reiserfs
102392 32840 69552 33% /home/togry/disks/rei
哟!reiserfs文件系统竟然占用了这么大的地方,三分之一都没有了。
4.创建两个1GB的文件进行比较。相比前面,这里要简略一些。
drwxr-xr-x 2 togry togry 48 2008-01-11 17:07 ext
-rw-r--r-- 1 togry togry 1073741824 2008-01-22 20:53 ext3
共3页: 上一页 1 [2] [3] 下一页 |