Last active
February 21, 2018 23:11
-
-
Save b2ag/058aee336bec57e06cb849528f4a3355 to your computer and use it in GitHub Desktop.
Calculates CRC32C checksum to repair a borked checksum in a except from that unimpaired Btrfs superblock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=32; sudo dd if=/dev/sdb1 of=/dev/stdout bs=1 skip=$(expr 65536 + $i ) count=$(expr 4096 - $i)|python -c "import crcmod; import sys; import struct; crc32c = crcmod.predefined.Crc('crc-32c'); crc32c.update(sys.stdin.buffer.read()); final_value=struct.unpack('<I', struct.pack('>I', crc32c.crcValue))[0]; print('0x{:08x}'.format(final_value));" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment