#!/usr/bin/env python3 """ Patch superblock to disable metadata_csum feature flag, and zero GDT checksum fields for groups 0-12. All writes go to dm-0 (overlay), nbd0 untouched. """ import struct DEV = '/dev/dm-0' BLOCK = 4096 BACKUP_SB_BLOCK = 32768 # Feature flag constants INCOMPAT_64BIT = 0x80 RO_COMPAT_METADATA_CSUM = 0x400 with open(DEV, 'r+b') as f: # Read primary superblock (already patched to block 0) f.seek(1024) sb = bytearray(f.read(1024)) # Check current feature flags ro_compat = struct.unpack_from('