19

On file systems like btrfs you can preform a scrub, which will go though all the data to see if the data still matches the file system checksum.

I would like to check the data on ext4 if it is correct before a backup.

Question

ext4 doesn't have file system checksum, but can something similar be made?

Sandra
  • 10,711
  • 41
  • 120
  • 173

4 Answers4

18

Ext4 doesn't have an equivalent to a ZFS or btrfs "scrub", however, a recent feature is metadata checksumming. Using it would require a very new kernel and an updated e2fsprogs.

What distribution are you using?

ewwhite
  • 201,205
3

@ewwhite answer is correct. I just want to stress that: NO - data cannot be checksummed in ext4 or XFS at this time. I also couldn't find anything related to checksumming for JFS. So the only reliable option so far is to check linux ZFS. BTRFS is not so stable at this time.

I'm writing the above because I've just hit bad silent write corruption on my router vs USB external drive and now I do not anymore trust USB as a reliable interconnect. So additional checksumming is required. (and I mean that the drive is completely healthy but router USB is flacky)

akostadinov
  • 1,247
2

While traditional filesystem as ext4 or XFS do not support data checksum, one can use dm-integrity to add checksum at the block level - under the fileystem itself.

You can use integritysetup to add checksum to any block device (note: it WILL erase any previous data), as mdadm-based array, or LVM-based RAID arrays

shodanshok
  • 52,255
0

There are some softwares you can test :

Basically they all compute and save files' checksums, so you can run it later again and compare and see if some checksums changed between 2 runs.