1. gzyueqian
      13352868059
      首頁 > 新聞中心 > > 正文

      Ext3和Reiserfs文件系統占用空間的比較

      更新時間: 2008-02-09 12:51:17來源: 粵嵌教育瀏覽量:534

         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%....
                  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

      drwxr-xr-x 2 togry togry 48 2008-01-11 17:07 rei

      -rw-r--r-- 1 togry togry 1073741824 2008-01-22 20:50 reiserfs

      其中etc3和reiserfs兩個文件就是“設備”。

       

      5.創建文件系統

       

       

      togry@xiaowp:~/disks$ sudo mkfs.reiserfs reiserfs -f
                  mkfs.reiserfs 3.6.19 (2003 www.namesys.com)
                  A pair of credits:
                  Edward Shushkin wrote the encryption and compression file plugins, and the V3
                  journal relocation code.
                  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.
                  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: 262144
                  Number of blocks consumed by mkreiserfs formatting process: 8219
                  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: 2b05d990-54b3-49c7-a197-79807a173c5b
                  Initializing journal - 0%....20%....40%....60%....80%....
                  Syncing..ok
                  Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
                  kernel based on 2.4.9, when you use reiserFS. Have fun.
                  ReiserFS is successfully created on reiserfs.
                  togry@xiaowp:~/disks$ sudo mkfs.ext
                  mkfs.ext2 mkfs.ext3
                  togry@xiaowp:~/disks$ sudo mkfs.ext3 ext
                  ext/ ext3
                  togry@xiaowp:~/disks$ sudo mkfs.ext3 ext3
                  mke2fs 1.40.4 (31-Dec-2007)
                  ext3 is not a block special device.
                  Proceed anyway? (y,n) y
                  Filesystem label=
                  OS type: Linux
                  Block size=4096 (log=2)
                  Fragment size=4096 (log=2)
                  131072 inodes, 262144 blocks
                  13107 blocks (5.00%) reserved for the super user
                  First data block=0
                  Maximum filesystem blocks=268435456
                  8 block groups
                  32768 blocks per group, 32768 fragments per group
                  16384 inodes per group
                  Superblock backups stored on blocks:
                  32768, 98304, 163840, 229376
                  Writing inode tables: done
                  Creating journal (8192 blocks): done
                  Writing superblocks and filesystem accounting information: done
                  This filesystem will be automatically checked every 28 mounts or
                  180 days, whichever comes first. Use tune2fs -c or -i to override.

       

      6.掛載文件系統之后查看空間的剩余情況

      togry@xiaowp:~/disks$ df

      文件系統 1K-塊 已用 可用 已用% 掛載點

      ......

      /home/togry/disks/ext3

      1032088 34092 945568 4% /home/togry/disks/ext

      /home/togry/disks/reiserfs

      1048540 32840 1015700 4% /home/togry/disks/rei

      togry@xiaowp:~/disks$ df -h

      文件系統 容量 已用 可用 已用% 掛載點

      ......

      /home/togry/disks/ext3

      1008M 34M 924M 4% /home/togry/disks/ext

      /home/togry/disks/reiserfs

      1.0G 33M 992M 4% /home/togry/disks/rei

      似乎文件空間的占用情況相當了。讓我們再看看2GB文件系統里的情況:

      7.創建文件:

      dd if=/dev/zero of=ext3 bs=1G count=2

      dd if=/dev/zero of=reiserfs bs=1G count=2

      看一下結果:

      drwxr-xr-x 2 togry togry 48 2008-01-11 17:07 ext

      -rw-r--r-- 1 togry togry 2147483648 2008-01-22 21:30 ext3

      drwxr-xr-x 2 togry togry 48 2008-01-11 17:07 rei

      -rw-r--r-- 1 togry togry 2147483648 2008-01-22 21:35 reiserfs

      8.創建文件系統:

       

       

      togry@xiaowp:~/disks$ sudo mkfs.ext3 ext3
                  mke2fs 1.40.4 (31-Dec-2007)
                  ext3 is not a block special device.
                  Proceed anyway? (y,n) y
                  Filesystem label=
                  OS type: Linux
                  Block size=4096 (log=2)
                  Fragment size=4096 (log=2)
                  262144 inodes, 524288 blocks
                  26214 blocks (5.00%) reserved for the super user
                  First data block=0
                  Maximum filesystem blocks=536870912
                  16 block groups
                  32768 blocks per group, 32768 fragments per group
                  16384 inodes per group
                  Superblock backups stored on blocks:
                  32768, 98304, 163840, 229376, 294912
                  Writing inode tables: done
                  Creating journal (16384 blocks): done
                  Writing superblocks and filesystem accounting information: done
                  This filesystem will be automatically checked every 25 mounts or
                  180 days, whichever comes first. Use tune2fs -c or -i to override.
                  togry@xiaowp:~/disks$ sudo mkfs.reiserfs reiserfs -f
                  mkfs.reiserfs 3.6.19 (2003 www.namesys.com)
                  A pair of credits:
                  BigStorage (www.bigstorage.com) contributes to our general fund every month,
                  and has done so for quite a long time.
                  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.
                  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: 524288
                  Number of blocks consumed by mkreiserfs formatting process: 8227
                  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: 0d3e668d-77e5-4b5d-a157-a3e937cbc7f4
                  Initializing journal - 0%....20%....40%....60%....80%....
                  Syncing..ok
                  Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
                  kernel based on 2.4.9, when you use reiserFS. Have fun.
                  ReiserFS is successfully created on reiserfs.

      這回創建文件系統的時間都比以前長了。

      9.掛載文件系統,看結果:

      togry@xiaowp:~/disks$ sudo mount ext3 ext -t ext3 -o loop && sudo mount reiserfs rei -t reiserfs -o loop

      togry@xiaowp:~/disks$ df

      文件系統 1K-塊 已用 可用 已用% 掛載點

      ......

      /home/togry/disks/ext3

      2064208 68680 1890672 4% /home/togry/disks/ext

      /home/togry/disks/reiserfs

      2097084 32840 2064244 2% /home/togry/disks/rei

      togry@xiaowp:~/disks$ df -h

      文件系統 容量 已用 可用 已用% 掛載點

      ......

      /home/togry/disks/ext3

      2.0G 68M 1.9G 4% /home/togry/disks/ext

      /home/togry/disks/reiserfs

      2.0G 33M 2.0G 2% /home/togry/disks/rei

       

      (三)綜上所做的實驗,我可以比較肯定的說對于ext3文件系統,當分區增大時,它本身所使用的空間也隨之較快的增長;而reiserfs系統的增長速度卻遠沒有ext3文件系統那樣快。此外由于reiserfs是真正的日志文件系統,所以它比較適用于經常對文件讀和寫的地方;而ext3文件系統也具有一定的日志功能,但是它的性能就沒那么好了。而對于小的分區,比如/boot,使用ext3或者是ext2作為基本上是只讀的分區就是非常理想的。

      免費預約試聽課

      亚洲另类欧美综合久久图片区_亚洲中文字幕日产无码2020_欧美日本一区二区三区桃色视频_亚洲AⅤ天堂一区二区三区

      
      

      1. 夜夜爽一区二区 | 日韩欧美精品一区二区三区动漫 | 性深夜福利免费网站 | 最新精品国偷自产在线91 | 肉体暴力强奷在线播放 | 日韩国产欧美亚洲 |