Writing large files into a ext4 with mkfs is truncating files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

We're creating file systems using mkfs.ext4 -d /path/to/fs, but I'm
seeing file corruption when adding a large file, which appears to
trigger if the file is over 4GB.

For example, 3GB of random data:
$ mkdir fs
$ dd if=/dev/urandom of=fs/foo status=progress bs=1M count=3K
$ md5sum fs/foo
e3c7e0243208b49b55dd8e4f7681302f  fs/foo
$ truncate -s 6G foo.ext4
$ /sbin/mkfs.ext4  foo.ext4 -d fs/
$ sudo mount foo.ext4 /mnt
$ md5sum /mnt/foo
e3c7e0243208b49b55dd8e4f7681302f  /mnt/foo

But by just changing count=3K to count=5K:

...
a2c04fdb5e717f3b79f6989390e1ce50  fs/foo
e5e54aec74285b3e750fe0b877363e1d  /mnt/foo

A little sleuthing:

$ cmp fs/foo  /mnt/foo
fs/foo /mnt/foo differ: byte 1073741825, line 4194938

Okay that's not the 4GB boundary. But dumping the values 10 bytes
either side of that point:

$ dd if=fs/foo skip=1073741815 bs=1 count=20|od -b -Anone
 333 024 335 134 327 122 306 256 064 107 345 031 037 125 107 355
$ dd if=/mnt/foo skip=1073741815 bs=1 count=20|od -b -Anone
 333 024 335 134 327 122 306 256 064 000 000 000 000 000 000 000

At some point mkfs.ext4 stopped copying content and simply padded with zeros.

This is e2fsprogs 1.43.4 and 1.44.3.  I've not yet tried 1.44.5 or git master.

Ross



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux