This is a weird request, but I had a hard drive that I initially ran badblocks on and then stopped partway through. So it started out with part of the drive covered in 0xAA and another part of the drive covered in 0x55. I then put NTFS filesystem on it, leaving the empty regions filled with this garbage, and then files written to it overwrote those regions.
Later the drive died, with many chunks of data missing throughout the entire drive.
It's now a raw image of an NTFS partition stored on a btrfs filesystem that I can probably delete, but I want to make sure there aren't any important files on it I can recover.
The drive image is taking up a lot more space than necessary because all of those 0xAA and 0x55 can't be stored as "holes". Likewise, NTFS recovery program DMDE lists a lot of "files" that contain nothing but 0xAA and 0x55.
Is there some way to go through and find any blocks/chunks/chains that are entirely 0xAA or 0x55 and blank them to 0x00 so they take up zero space on the btrfs volume? They aren't zero, but they don't contain any information either.
ddon a source file,|pipe it totrwhich filters the values and>redirects the stdout to a destination file. Possibly very slow. – Yorik May 27 '21 at 18:37fstrimeasily makes my images of NTFS sparse. The problem here is the filesystem is not healthy. Note the OP uses a recovery program, so it's not about copying files the filesystem knows about. Zeroing allegedly free space in whatever way will overwrite lost files the OP hopes to recover later. – Kamil Maciorowski May 27 '21 at 19:20trto translate every 0xAA and 0x55 to 0x00 and save a translated copy. Some of 0xAA or 0x55 are meaningful and should not be translated. So use this answer to detect sectors of zeros in the translated copy, but instead of--fill-mode=+use--fill-mode=?to zero sectors that are zeros in the translated copy; but do this on the original. This way you will zero sectors containing nothing more than 0xAA, 0x55 and 0x00. – Kamil Maciorowski May 27 '21 at 19:24