ext3 与 ext4 - 磁盘大小相同,但与 ext3 相比,ext4 下的可用磁盘空间更少。为什么?

ext3 与 ext4 - 磁盘大小相同,但与 ext3 相比,ext4 下的可用磁盘空间更少。为什么?

从 ext3 文件系统复制的文件不适合相同大小的 ext4 文件系统。

如何重现:

创建两个 1GB 文件,

为每个设置循环设备,

创建文件系统1个ext3,1个ext4,

山,

rsync 文件从 /usr/lib 到 ext3 文件夹直到满,

尝试将文件从 ext3 文件夹同步到 ext4,但由于磁盘空间问题而失败。

我希望 ext3 文件夹中的所有文件都适合 ext4 文件夹

(查看日志,下一个要复制的文件大于可用空间,并且还有一些文件需要复制)

有人可以解释为什么吗?或者更好的是如何使用 ext4 获得相同或更多的可用磁盘空间?

这是debian8系统

root@blackoil:~#  uname -a
Linux blackoil 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt7-1 (2015-03-01) x86_64 GNU/Linux


root@blackoil:~# dd if=/dev/zero of=e3fs bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 6.07722 s, 173 MB/s


root@blackoil:~# dd if=/dev/zero of=e4fs bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 6.21495 s, 169 MB/s



root@blackoil:~# losetup /dev/loop3 e3fs
root@blackoil:~# losetup /dev/loop4 e4fs
root@blackoil:~# mkfs.ext3 -m 0 /dev/loop3



mke2fs 1.42.12 (29-Aug-2014)
Discarding device blocks: done                            
Creating filesystem with 256000 4k blocks and 64000 inodes
Filesystem UUID: 8871cd27-5c82-4fa9-acaa-11c2ca200d08
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done



root@blackoil:~# mkfs.ext4 /dev/loop4
mke2fs 1.42.12 (29-Aug-2014)
Discarding device blocks: done                            
Creating filesystem with 256000 4k blocks and 64000 inodes
Filesystem UUID: 71b69de9-0858-4189-8e1f-907efd61f51d
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done



root@blackoil:~# mkdir -p /mnt/e3
root@blackoil:~# mkdir -p /mnt/e4



root@blackoil:~# dumpe2fs /dev/loop3
dumpe2fs 1.42.12 (29-Aug-2014)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          8871cd27-5c82-4fa9-acaa-11c2ca200d08
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              64000
Block count:              256000
Reserved block count:     0
Free blocks:              247557
Free inodes:              63989
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      62
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8000
Inode blocks per group:   500
Filesystem created:       Mon Jul 20 15:21:53 2015
Last mount time:          n/a
Last write time:          Mon Jul 20 15:21:53 2015
Mount count:              0
Maximum mount count:      -1
Last checked:             Mon Jul 20 15:21:53 2015
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      a35b09fe-b755-49b6-a94d-eb8f2960e5a6
Journal backup:           inode blocks
Journal features:         (none)
Journal size:             16M
Journal length:           4096
Journal sequence:         0x00000001
Journal start:            0



root@blackoil:~# dumpe2fs /dev/loop4
dumpe2fs 1.42.12 (29-Aug-2014)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          71b69de9-0858-4189-8e1f-907efd61f51d
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              64000
Block count:              256000
Reserved block count:     12800
Free blocks:              247562
Free inodes:              63989
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      62
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8000
Inode blocks per group:   500
Flex block group size:    16
Filesystem created:       Mon Jul 20 15:22:16 2015
Last mount time:          n/a
Last write time:          Mon Jul 20 15:22:16 2015
Mount count:              0
Maximum mount count:      -1
Last checked:             Mon Jul 20 15:22:16 2015
Check interval:           0 (<none>)
Lifetime writes:          16 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      33846c93-9d1a-4117-a7c8-1566e96e8e73
Journal backup:           inode blocks
Journal features:         (none)
Journal size:             16M
Journal length:           4096
Journal sequence:         0x00000001
Journal start:            0




root@blackoil:~# mount /dev/loop3 /mnt/e3
root@blackoil:~# mount /dev/loop4 /mnt/e4


root@blackoil:~# rsync -a /usr/lib /mnt/e3
rsync: recv_generator: mkdir "/mnt/e3/lib/python2.6/xml/sax" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
rsync: write failed on "/mnt/e3/lib/python2.6/httplib.py": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(393) [receiver=3.1.1]


root@blackoil:~# df |grep '/mnt/e'
/dev/loop3            991512    991512         0 100% /mnt/e3
/dev/loop4            991512      1264    922664   1% /mnt/e4

root@blackoil:~# cd /mnt/e3

root@blackoil:/mnt/e3# rsync -a . /mnt/e4
rsync: write failed on "/mnt/e4/lib/pepperflashplugin-nonfree/libpepflashplayer.so": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(393) [receiver=3.1.1]

root@blackoil:/mnt/e3# df | grep '/mnt/e'
/dev/loop3            991512    991512         0 100% /mnt/e3
/dev/loop4            991512    959372         0 100% /mnt/e4
root@blackoil:/mnt/e3# df -i | grep '/mnt/e'
/dev/loop3            64000    8939    55061   14% /mnt/e3
/dev/loop4            64000    8531    55469   14% /mnt/e4

root@blackoil:/mnt/e3# rsync -av . /mnt/e4
sending incremental file list
lib/pepperflashplugin-nonfree/
lib/pepperflashplugin-nonfree/libpepflashplayer.so
lib/pepperflashplugin-nonfree/manifest.json
lib/pepperflashplugin-nonfree/pubkey-google.txt
lib/pkgconfig/dbus-python.pc
lib/pkgconfig/geoclue-2.0.pc
lib/pkgconfig/gnome-system-tools.pc
lib/pkgconfig/keybinder.pc
lib/pkgconfig/libgdiplus.pc
lib/pkgconfig/libquvi-scripts.pc
lib/pkgconfig/libwnck-1.0.pc
lib/pkgconfig/libxfce4menu-0.1.pc
lib/pkgconfig/libxklavier.pc
lib/pkgconfig/notify-python.pc
lib/pkgconfig/pm-utils.pc
lib/pkgconfig/tomboy-addins.pc
lib/pkgconfig/unique-1.0.pc
lib/pkgconfig/xkbcomp.pc
lib/pkgconfig/xorg-wacom.pc
lib/pm-utils/

( ......   some removed due to 30000 lines limit posting question)

rsync: write failed on "/mnt/e4/lib/pepperflashplugin-nonfree/libpepflashplayer.so": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(393) [receiver=3.1.1]

root@blackoil:/mnt/e3# df |grep 'mnt/e'
/dev/loop3            991512    991512         0 100% /mnt/e3
/dev/loop4            991512    959372         0 100% /mnt/e4

root@blackoil:/mnt/e3# ls -l /mnt/e4/lib/pepperflashplugin-nonfree/libpepflashplayer.so
ls: cannot access /mnt/e4/lib/pepperflashplugin-nonfree
/libpepflashplayer.so: No such file or directory


root@blackoil:/mnt/e3# ls -l lib/pepperflashplugin-nonfree/libpepflashplayer.so
-rw-r--r-- 1 root root 17370752 Mar 14 09:08 lib/pepperflashplugin-nonfree/libpepflashplayer.so


root@blackoil:/mnt/e3# mount |grep 'mnt/e'
/dev/loop3 on /mnt/e3 type ext3 (rw,relatime,data=ordered)
/dev/loop4 on /mnt/e4 type ext4 (rw,relatime,data=ordered)

答案1

它在您的储备块计数中:

ext3:块计数:256000 保留块计数:0

ext4:块数:256000 保留块数:12800

修复:#tune2fs -m 0 e4fs

相关内容