Basically, the EXT4 filesystem has chunks of data in size of 128MiB (by default), and this chunk is called a "group" or "group of blocks", which basically looks like this on the disk:

enter image description here

The bigger the disk, the more groups you have one after the other.

When you use the dumpe2fs tool, it can simply tell you how many groups you have and return also some info about them, for instance:

Group 690: (Blocks 22609920-22642687) csum 0x7443 [ITABLE_ZEROED]
  Block bitmap at 22544386 (bg #688 + 2), csum 0xab2a9072
  Inode bitmap at 22544402 (bg #688 + 18), csum 0x1ef9c14a
  Inode table at 22545440-22545951 (bg #688 + 1056)
  0 free blocks, 8182 free inodes, 10 directories, 8182 unused inodes
  Free blocks: 
  Free inodes: 5652491-5660672

And my question is: what would happen if you zeroed out the whole group of blocks using the dd tool?

If you had a file (files) small enough to fit entirely in that group, the file (files) would be permanently lost. But there are other cases, and I'm not sure how system reacts in such situations.

  1. Files can be fragmented and described by many groups of blocks, which (in this case) means that only some part of a file was zeroed out. What would happen to that file after fsck is run? Will the entire file be placed in lost&found dir? Or maybe would it be visible in the filesystem's structure, but you won't be able to open/access it?

  2. What would happen to the files in the directories if the group above was zeroed out? There's only info that 0 free blocks, 8182 free inodes, 10 directories, 8182 unused inodes, which means that 10 dirs and 0 files are described by this group, and all blocks are used by data. So we have 10 dirs and probably some big file which is fragmented. At least I understand the info in this way. But the dirs can contain files, and what would happen to the files in the dirs when you zero out this group? Will they be accessible after fsck?


Basically it boils down to whether the meta data and/or the data is affected.

Generally speaking, when the meta data is corrupted the affected files/directories become inaccessible (or partially inaccessible). Tools such as fsck may be able to fix the corruption, but it really depends on precisely what has been damaged.

However, when the data is corrupted unless the filesystem implements data checksums, which EXT4 does not, the filesystem will act as if the data is fine. It is up to the application to validate and perform repairs, if possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.