On Fri, 2006-09-08 at 14:55 +0000, Mark Krenz wrote: > Before you say, DON'T DO IT THAT WAY, let me assure you that I have my > reasons and I'm aware of the risks. This is mostly related to my > question about changing UUIDs of physical volumes and volume groups. > Anyways, I thought that perhaps I could try to use hexedit to modify the > UUID within the image file. However, after I did this I ran into all > the lvm commands complaining about checksum errors in the metadata. So > my question is, where is the checksum stored and how is it calculated. > I noticed that there is an "LVM header near the beginning of the disk > followed by a long string: > > LABELONE........?... ...LVM2 001M0U7CEZK8M7l2Z4KnOtI1uSVjAu0cCFd > > Is that last part the checksum? What kind is it? > > after a fast read of sources, i think checksum is computed here : lib/misc/crc.c : /* Calculate an endian-independent CRC of supplied buffer */ uint32_t calc_crc(uint32_t initial, void *buf, uint32_t size) { static const uint32_t crctab[] = { 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; uint32_t i, crc = initial; uint8_t *data = (uint8_t *) buf; for (i = 0; i < size; i++) { crc ^= *data++; crc = (crc >> 4) ^ crctab[crc & 0xf]; crc = (crc >> 4) ^ crctab[crc & 0xf]; } return crc; } Here is the call : lib/format_text/format-text.c,139 : if (mdah->checksum_xl != xlate32(calc_crc(INITIAL_CRC, mdah->magic, MDA_HEADER_SIZE - sizeof(mdah->checksum_xl)))) { log_error("Incorrect metadata area header checksum"); return NULL; } -- Fabien Jakimowicz <fabien@jakimowicz.com>
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/