Skip to contentSkip to conversation

brainfart: lilo'd a PV

linux-lvm Brian J. Murrell 5 participants 7 messages Dec 17, 2009 – Dec 18, 2009

lore
Share & tools
lore
#0 lore raw

I managed to write a lilo block (lilo) to the start of a PV which I have on /dev/sda (note, /dev/sda is a whole disk PV, unpartitioned).

However, looking at a number of different PVs here, it appears that the LVM data starts at 0x200 with: "LABELONE". i.e.:

# hexdump -C /dev/sdc3
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
...
# hexdump -C /dev/sdb
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001b0  00 00 00 00 00 00 00 00  dc 59 0f 10 cf c9 00 00  |.........Y......|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
...
# hexdump -C /dev/sda 
00000000  fa eb 31 12 00 00 4c 49  4c 4f 16 08 10 00 01 00  |..1...LILO......|
...
00000180  30 e4 cd 13 eb 91 e8 93  fe 44 69 73 6b 20 72 65  |0........Disk re|
00000190  61 64 20 65 72 72 6f 72  0d 0a 00 00 00 00 00 00  |ad error........|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  c6 08 1a 45 cf c9 00 00  |...........E....|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|

Is that correct?

Is there anything I should do to repair this or is my brainfart benign to this PV?

Thanx!

b.

#1 lore raw
Quoted 31 lines · Brian J. Murrell

I managed to write a lilo block (lilo) to the start of a PV which I have on /dev/sda (note, /dev/sda is a whole disk PV, unpartitioned).

However, looking at a number of different PVs here, it appears that the LVM data starts at 0x200 with: "LABELONE". i.e.:

# hexdump -C /dev/sdc3
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
...
# hexdump -C /dev/sdb
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001b0  00 00 00 00 00 00 00 00  dc 59 0f 10 cf c9 00 00  |.........Y......|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
...
# hexdump -C /dev/sda 
00000000  fa eb 31 12 00 00 4c 49  4c 4f 16 08 10 00 01 00  |..1...LILO......|
...
00000180  30 e4 cd 13 eb 91 e8 93  fe 44 69 73 6b 20 72 65  |0........Disk re|
00000190  61 64 20 65 72 72 6f 72  0d 0a 00 00 00 00 00 00  |ad error........|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  c6 08 1a 45 cf c9 00 00  |...........E....|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
Quoted 1 line

Is that correct?

Yes. The area begin with "LABELONE" is PV label, which is recorded in the first sector by default. This is the description from the pvcreate man page.

--labelsector sector
By default the PV is labelled with an LVM2 identifier in its second sector (sector 1). This lets you use a different sector near the start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORS in the source). Use with care.

Quoted 2 lines

Is there anything I should do to repair this or is my brainfart benign to this PV?

You don't have any problem on the PV, do you? I don't think you need something to repair the PV.

Thanks,
Taka

#2 lore raw
Quoted 2 lines · Takahiro Yasui

Yes. The area begin with "LABELONE" is PV label,

Looks like the LVM developers foresaw my brainfart and left the first sector of the disk for me to bugger up without buggering up LVM. :-)

Quoted 2 lines

which is recorded in
the first sector by default.

Hrm. Do you really mean "first" there or second, which is sector 1 if you start counting with 0?

Quoted 6 lines

This is the description from the pvcreate
man page.

--labelsector sector
By default the PV is labelled with an LVM2 identifier in its second sector (sector 1).

Yes, this looks so.

Quoted 5 lines

This lets you use a different sector
near the start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORS in the source). Use with care.

You don't have any problem on the PV, do you?

I don't think I do:

# pvdisplay /dev/sda
  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               datavol
  PV Size               931.51 GB / not usable 1.71 MB
  Allocatable           yes 
  PE Size (KByte)       4096
  Total PE              238467
  Free PE               85356
  Allocated PE          153111
  PV UUID               C22uVB-4m26-5cvl-I11V-NXCm-mVNo-UTAXUH

But of course, I just want to get the opinion of the experts.

Quoted 1 line

I don't think you need something to repair the PV.

I don't think so either, but of course, do want to confirm my suspicion.

Thanx much for your insight.

b.

#3 lore raw
Quoted 6 lines · Brian J. Murrell [[email protected]] wrote:
Quoted 2 lines · Takahiro Yasui

Yes. The area begin with "LABELONE" is PV label,

Looks like the LVM developers foresaw my brainfart and left the first sector of the disk for me to bugger up without buggering up LVM. :-)

Partition table uses the first sector (0th sector), so pretty much every other software that uses labels avoid the first sector.

Quoted 5 lines
Quoted 2 lines

which is recorded in
the first sector by default.

Hrm. Do you really mean "first" there or second, which is sector 1 if you start counting with 0?

He really meant sector 1!

You are just lucky!

#4 lore raw
Quoted 9 lines · [email protected] wrote:
Quoted 4 lines · Brian J. Murrell [[email protected]] wrote:
Quoted 1 line · Takahiro Yasui

Yes. The area begin with "LABELONE" is PV label,

Looks like the LVM developers foresaw my brainfart and left the first sector of the disk for me to bugger up without buggering up LVM. :-)

Partition table uses the first sector (0th sector), so pretty much every other software that uses labels avoid the first sector.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

which is recorded in
the first sector by default.

Hrm. Do you really mean "first" there or second, which is sector 1 if you start counting with 0?

He really meant sector 1!

Oops, sorry for confusion. The sector number begins with 0, so the sector 1 should have been written as the "second" sector.

Thank you for correction, Malahal.

Thanks,
Taka

#5 lore raw
In reply to Brian J. Murrell
Quoted 4 lines
Quoted 1 line

Yes. The area begin with "LABELONE" is PV label,

Looks like the LVM developers foresaw my brainfart and left the first sector of the disk for me to bugger up without buggering up LVM. :-)

Applause.
--
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php

Quoted 46 lines · Brian J. Murrell
Quoted 2 lines · Takahiro Yasui

Yes. The area begin with "LABELONE" is PV label,

Looks like the LVM developers foresaw my brainfart and left the first sector of the disk for me to bugger up without buggering up LVM. :-)

Quoted 2 lines

which is recorded in
the first sector by default.

Hrm. Do you really mean "first" there or second, which is sector 1 if you start counting with 0?

Quoted 5 lines

This is the description from the pvcreate
man page.

--labelsector sector
By default the PV is labelled with an LVM2

identifier in its

Quoted 1 line

second sector (sector 1).

Yes, this looks so.

Quoted 2 lines

This lets you use a different sector
near the start of the disk (between 0 and 3

inclusive - see

Quoted 3 lines

LABEL_SCAN_SECTORS in the source). Use with care.

You don't have any problem on the PV, do you?

I don't think I do:

# pvdisplay /dev/sda
  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               datavol
  PV Size               931.51 GB / not usable 1.71 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              238467
  Free PE               85356
  Allocated PE          153111
  PV UUID               C22uVB-4m26-5cvl-I11V-NXCm-mVNo-UTAXUH

But of course, I just want to get the opinion of the experts.

Quoted 9 lines
Quoted 1 line

I don't think you need something to repair the PV.

I don't think so either, but of course, do want to confirm my suspicion.

Thanx much for your insight.

b.

------quoted attachment------

Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#6 lore raw
In reply to Takahiro Yasui
Quoted 44 lines · Takahiro Yasui
Quoted 31 lines · Brian J. Murrell

I managed to write a lilo block (lilo) to the start of a PV which I have on /dev/sda (note, /dev/sda is a whole disk PV, unpartitioned).

However, looking at a number of different PVs here, it appears that the LVM data starts at 0x200 with: "LABELONE". i.e.:

# hexdump -C /dev/sdc3
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
...
# hexdump -C /dev/sdb
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001b0  00 00 00 00 00 00 00 00  dc 59 0f 10 cf c9 00 00  |.........Y......|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
...
# hexdump -C /dev/sda 
00000000  fa eb 31 12 00 00 4c 49  4c 4f 16 08 10 00 01 00  |..1...LILO......|
...
00000180  30 e4 cd 13 eb 91 e8 93  fe 44 69 73 6b 20 72 65  |0........Disk re|
00000190  61 64 20 65 72 72 6f 72  0d 0a 00 00 00 00 00 00  |ad error........|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  c6 08 1a 45 cf c9 00 00  |...........E....|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
Quoted 1 line

Is that correct?

Yes. The area begin with "LABELONE" is PV label, which is recorded in the first sector by default. This is the description from the pvcreate man page.

--labelsector sector
By default the PV is labelled with an LVM2 identifier in its second sector (sector 1). This lets you use a different sector near the start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORS in the source). Use with care.

Quoted 5 lines
Quoted 2 lines

Is there anything I should do to repair this or is my brainfart benign to this PV?

You don't have any problem on the PV, do you? I don't think you need something to repair the PV.

Yeah, you should be fine here since LVM2 does not use the 1st sector of the device and the MBR (and hence lilo) does all its work in that 1st sector. The LVM2 PV label begins in the 2nd sector (as you've noticed) and has been left intact by these changes.

You could always zero out sector 0 to avoid confusion:

dd if=/dev/zero of=/path/to/pv bs=512 count=1

Regards,
Bryn.