3

Files copied from ext3 filesystem do not fit on same size ext4 filesystem.

How to reproduce:

create two 1GB files,

setup loop device for each,

create filesystem one ext3, one ext4,

mount,

rsync files from /usr/lib into ext3 folder until full,

try to rsync files from ext3 folder into ext4 but this failes due to disk space.

I would expect all files from ext3 folder to fit into ext4 folder

(see log, next file to copy is larger than available space, and still some more files left to copy)

Can someone explain why? or better what to do to get same or more usable disk space using ext4?

this is debian8 system

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)
  • mkfs.ext3 -m 0 /dev/loop3 mkfs.ext4 -m 0 /dev/loop4 mount /dev/loop3 /mnt/e3 mount /dev/loop4 /mnt/e4 dd if=/dev/zero of=/mnt/e3/ddfile dd: writing to ‘/mnt/e3/ddfile’: No space left on device 1978513+0 records in 1978512+0 records out 1012998144 bytes (1.0 GB) copied, 7.92553 s, 128 MB/s dd if=/dev/zero of=/mnt/e4/ddfile dd: writing to ‘/mnt/e4/ddfile’: No space left on device 1947649+0 records in 1947648+0 records out 997195776 bytes (997 MB) copied, 8.00902 s, 125 MB/s funny – lepoitr Jul 20 '15 at 19:01
  • df |grep mnt/e /dev/loop3 991512 991512 0 100% /mnt/e3 /dev/loop4 991512 975092 36 100% /mnt/e4 df -i |grep mnt/e /dev/loop3 64000 12 63988 1% /mnt/e3 /dev/loop4 64000 12 63988 1% /mnt/e4 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) – lepoitr Jul 20 '15 at 19:07
0

It's in your reserve block count:

ext3: Block count: 256000 Reserved block count: 0

ext4: Block count: 256000 Reserved block count: 12800

the fix: # tune2fs -m 0 e4fs

  • this only explains why df shows 0%free, but not why files from ext3 filesystem do not fit on ext4. All commands were executed as root, so the reserved block dos not apply as a reason why there is not enough disk space to copy files. Changed reserved disk space but that does not help. – lepoitr Jul 20 '15 at 18:02
  • root@blackoil:~# tune2fs -m 0 /dev/loop4 tune2fs 1.42.12 (29-Aug-2014) Setting reserved blocks percentage to 0% (0 blocks) root@blackoil:~# df |grep 'mnt/e' /dev/loop3 991512 991512 0 100% /mnt/e3 /dev/loop4 991512 959372 15756 99% /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# – lepoitr Jul 20 '15 at 18:06
  • Hrm, You have me stumped then. Does the behavior persist if you blow away the ext4 and do a raw copy instead of rsync? My only other thought is there are journal settings on the ext4 setting that don't match the ext3 journal settings; disable the journal on ext4 and see if that fixes it? Out of curiosity, what's your use case for trying to pack your files in so tightly? – Stephan Jul 20 '15 at 18:30
  • same for cp: root@blackoil:~# umount /mnt/e4 root@blackoil:~# mkfs.ext4 -m 0 /dev/loop4 root@blackoil:~# mount /dev/loop4 /mnt/e4 root@blackoil:~# cd /mnt/e3 root@blackoil:/mnt/e3# df |grep mnt/e /dev/loop3 991512 991512 0 100% /mnt/e3 /dev/loop4 991512 1264 973864 1% /mnt/e4 root@blackoil:/mnt/e3# df -i |grep mnt/e /dev/loop3 64000 8939 55061 14% /mnt/e3 /dev/loop4 64000 11 63989 1% /mnt/e4 root@blackoil:/mnt/e3# cp -a . /mnt/e4 cp: error writing ‘/mnt/e4/./lib/libpurple.so.0.10.11’: No space left on device – lepoitr Jul 20 '15 at 18:36
  • Journal backup: inode blocks Journal features: (none) Journal size: 16M Journal length: 4096 Journal sequence: 0x00000001 Journal start: 0 same journal on both. anyway, i want journaled filesystem, not ext2 for a 2TB drive, but selecting ext4 over ext3 means loosing 2-3% of available disk space – lepoitr Jul 20 '15 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.