From: "Theodore Ts'o" <tytso@mit.edu>
To: bugzilla-daemon@kernel.org
Cc: linux-ext4@vger.kernel.org
Subject: Re: [Bug 220288] New: A typo Leads to loss of all data on disk
Date: Fri, 27 Jun 2025 22:48:37 -0400 [thread overview]
Message-ID: <20250628024837.GC4253@mit.edu> (raw)
In-Reply-To: <bug-220288-13602@https.bugzilla.kernel.org/>
I don't see how that happened. /dev/sdc has a partition table at the
beginning of the disk. That partition table contains the definition
of /dev/sdc1.
So if you ran "fsck.ext4 /dev/sdc" instead of "fsck.ext4 /dev/sdc1",
you should have gotten something like this:
root@xfstests:~# fsck.ext4 /dev/sdb
e2fsck 1.47.2-rc1 (28-Nov-2024)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sdb
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
Found a gpt partition table in /dev/sdb
In any case, fsck.ext4 will not make any changes unless you give it
permission by answering "yes". For example (do not try this at home,
kids):
root@xfstests:~# debugfs -w -R "clri <2>" /dev/sdb1 ; debugfs -w -R "ssv state 2" /dev/sdb1
debugfs 1.47.2-rc1 (28-Nov-2024)
debugfs 1.47.2-rc1 (28-Nov-2024)
root@xfstests:~# fsck.ext4 /dev/sdb1
e2fsck 1.47.2-rc1 (28-Nov-2024)
/dev/sdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory. Clear<y>? yes
Pass 2: Checking directory structure
Entry '..' in <2>/<11> (11) has deleted/unused inode 2. Clear<y>? yes
Pass 3: Checking directory connectivity
Root inode not allocated. Allocate<y>? yes
Unconnected directory inode 11 (was in /)
Connect to /lost+found<y>? yes
/lost+found not found. Create<y>? yes
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Inode 11 ref count is 3, should be 2. Fix<y>? yes
Pass 5: Checking group summary information
/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 13/655360 files (0.0% non-contiguous), 67263/2620928 blocks
See how fsck.ext4 asks for permission before it makes any change to
the filesystem?
next prev parent reply other threads:[~2025-06-28 2:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 22:22 [Bug 220288] New: A typo Leads to loss of all data on disk bugzilla-daemon
2025-06-28 2:48 ` Theodore Ts'o [this message]
2025-06-28 2:48 ` [Bug 220288] " bugzilla-daemon
2025-06-28 8:47 ` bugzilla-daemon
2025-06-28 8:57 ` bugzilla-daemon
2025-06-28 9:37 ` bugzilla-daemon
2025-06-28 21:32 ` bugzilla-daemon
2025-06-28 21:39 ` bugzilla-daemon
2025-07-02 19:36 ` bugzilla-daemon
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=20250628024837.GC4253@mit.edu \
--to=tytso@mit.edu \
--cc=bugzilla-daemon@kernel.org \
--cc=linux-ext4@vger.kernel.org \
/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).