mke2fs with size limit and default discard will discard data after size limit

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

 



mke2fs with a specified size and the default-enabled "discard" option
will discard data after that specified size. If using the size (and
potentially offset) to write a partition within a disk or disk image,
this will zero part of the following partition.

Steps to reproduce:

# Make a 128M disk filled with 0x0a, to see which bytes get written
yes '' | dd iflag=fullblock of=test.img bs=1M count=128
# Show the disk filled with 0x0a
hd test.img
# Make a 1M filesystem, which shouldn't touch the remaining 127M
mkfs.ext4 -b 4096 -I 256 test.img 1M
# Show the disk, which has had data discarded to the 16M boundary
hd test.img

This also applies if you pass an offset; for instance, passing
offset=4096 will discard data from 4096 to 16M+4096 before writing the
filesystem.

Passing -E nodiscard works around this; the remainder of e2fsprogs does
seem to avoid writing outside the bounds.

(Discovered via some debugging adventures with disk image building. Also
reported to Debian as https://bugs.debian.org/989630 since I first
encountered it there, but sending to linux-ext4 as a more appropriate
place for e2fsprogs bug reports.)

- Josh Triplett



[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