From: Josh Triplett <josh@joshtriplett.org>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca
Subject: mke2fs with size limit and default discard will discard data after size limit
Date: Tue, 8 Jun 2021 21:36:46 -0700 [thread overview]
Message-ID: <YMBFXi22cilZTPUk@localhost> (raw)
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
reply other threads:[~2021-06-09 4:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YMBFXi22cilZTPUk@localhost \
--to=josh@joshtriplett.org \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).