* [linux-lvm] LVM metadata checksums
@ 2006-09-08 14:55 Mark Krenz
2006-09-08 15:23 ` Fabien Jakimowicz
2006-09-08 23:04 ` Alasdair G Kergon
0 siblings, 2 replies; 3+ messages in thread
From: Mark Krenz @ 2006-09-08 14:55 UTC (permalink / raw)
To: linux-lvm
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?
--
Mark S. Krenz
IT Director
Suso Technology Services, Inc.
http://suso.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-lvm] LVM metadata checksums
2006-09-08 14:55 [linux-lvm] LVM metadata checksums Mark Krenz
@ 2006-09-08 15:23 ` Fabien Jakimowicz
2006-09-08 23:04 ` Alasdair G Kergon
1 sibling, 0 replies; 3+ messages in thread
From: Fabien Jakimowicz @ 2006-09-08 15:23 UTC (permalink / raw)
To: LVM general discussion and development
[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]
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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-lvm] LVM metadata checksums
2006-09-08 14:55 [linux-lvm] LVM metadata checksums Mark Krenz
2006-09-08 15:23 ` Fabien Jakimowicz
@ 2006-09-08 23:04 ` Alasdair G Kergon
1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2006-09-08 23:04 UTC (permalink / raw)
To: LVM general discussion and development
On Fri, Sep 08, 2006 at 02:55:27PM +0000, Mark Krenz wrote:
> Anyways, I thought that perhaps I could try to use hexedit to modify the
> UUID within the image file.
Use the tools!
pvchange --uuid
vgchange --uuid
Never edit on-disk metadata by hand!
Use vgcfgbackup to read it into a file, edit the file, then put
it back with vgcfgrestore. (With pvcreates before restoring if necessary.)
Alasdair
--
agk@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-08 23:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-08 14:55 [linux-lvm] LVM metadata checksums Mark Krenz
2006-09-08 15:23 ` Fabien Jakimowicz
2006-09-08 23:04 ` Alasdair G Kergon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).