* mke2fs with size limit and default discard will discard data after size limit
@ 2021-06-09 4:36 Josh Triplett
0 siblings, 0 replies; only message in thread
From: Josh Triplett @ 2021-06-09 4:36 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, adilger.kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-09 4:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-09 4:36 mke2fs with size limit and default discard will discard data after size limit Josh Triplett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).