Skip to contentSkip to conversation

sector zero on a Logical Volume

linux-lvm Gene Czarcinski 2 participants 3 messages Jul 13, 2008 – Jul 14, 2008

lore
Share & tools
lore
#0 lore raw

I am hoping that someone on this mailing list is expert enough to answer my question:

Is there any reason that sector 0 on a Logical Volume should not be all zeros?

I guess I am really asking if any filesystem uses sector 0 on a Logical Volume.

My problem occurred when I effectively dd'ed a real disk partition on which grub is installed to a Logical Volume. When grub in installed into a partition, it not only installs it's boot code but also makes sector 0 on that partition have a fake "msdos" partition table and the kernel (and other software) does not like that at all!!

My solution was to use dd to zero sector 0 and then everything worked ... could mount the Logical Volume, etc.

Gene

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · Gene Czarcinski

I am hoping that someone on this mailing list is expert enough to answer my question:

Is there any reason that sector 0 on a Logical Volume should not be all zeros?

All depends what you are doing with it. Many file systems and other block device users avoid using this sector because it may be "shared" with the firmware on x86 but there's no requirement for it to be reserved like this. Ext2/3 are fine (they start in the 1st sector) as would be LVM2 - e.g. if you were using the LV to provide a physical volume for a virtualised system.

Quoted 5 lines

My problem occurred when I effectively dd'ed a real disk partition on which grub is installed to a Logical Volume. When grub in installed into a partition, it not only installs it's boot code but also makes sector 0 on that partition have a fake "msdos" partition table and the kernel (and other software) does not like that at all!!

It is not a "fake" msdos partition table, it's a real one. The conventions for x86 boot loaders require a partition table since the MBR (master boot record) consists of a 512 byte sector containing 446 bytes of executable code followed by the four-entry primary partition table.

You can't install grub without an MBR/partition table so when you attempt to install it to a device that lacks one grub will lay down a skeleton MBR on the device.

Quoted 2 lines

My solution was to use dd to zero sector 0 and then everything worked ... could mount the Logical Volume, etc.

Shouldn't be a problem for anything that doesn't store data in this sector. Just be sure to limit the command to only wipe sector 0.

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFIeyug6YSQoMYUY94RAurDAJ4keJuVilimG/ftZbFLt18PP6btEQCfUrSL cSAZeVbaOwxI+uySMI8qzWQ=
=hDCA
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 20 lines · On Monday 14 July 2008 06:34:08 Bryn M. Reeves wrote:
Quoted 5 lines · Gene Czarcinski

I am hoping that someone on this mailing list is expert enough to answer my question:

Is there any reason that sector 0 on a Logical Volume should not be all zeros?

All depends what you are doing with it. Many file systems and other block device users avoid using this sector because it may be "shared" with the firmware on x86 but there's no requirement for it to be reserved like this. Ext2/3 are fine (they start in the 1st sector) as would be LVM2 - e.g. if you were using the LV to provide a physical volume for a virtualised system.

Quoted 5 lines

My problem occurred when I effectively dd'ed a real disk partition on which grub is installed to a Logical Volume. When grub in installed into a partition, it not only installs it's boot code but also makes sector 0 on that partition have a fake "msdos" partition table and the kernel (and other software) does not like that at all!!

Quoted 4 lines

It is not a "fake" msdos partition table, it's a real one. The conventions for x86 boot loaders require a partition table since the MBR (master boot record) consists of a 512 byte sector containing 446 bytes of executable code followed by the four-entry primary partition table.

If the partition table was defined in an MBR ... yes, that is a real one. But this is installed in a partition. I suspect that grub does not "know" if it is installing in a partition or the MBR for a real disk.

I do note (just looked) and both ntfs and fat32 disks step on sector 0 of a partition with a skelaton partition table and "msdos" partition table signature.

Quoted 4 lines

You can't install grub without an MBR/partition table so when you attempt to install it to a device that lacks one grub will lay down a skeleton MBR on the device.

device==yes but this was a partition.

One thing I want to try is to zap the "signature" and see if grub will still boot.

Quoted 6 lines
Quoted 3 lines

My solution was to use dd to zero sector 0 and then everything worked ... could mount the Logical Volume, etc.

Shouldn't be a problem for anything that doesn't store data in this sector. Just be sure to limit the command to only wipe sector 0.

Thanks for the reply.

From what you said, I understand that most linux filesystems stay away from sector 0. I have verified this for ext2/ext3 and xfs. It is unlikely that any native use of a Logical Volume will use sector 0.

But, there could be a situation with a virtual machine where a Logical Volume was being used as a virtual physical volume. Furthermore, with grub, ntfs, and fat32 put a partition table in sector 0 of a partition.

Gene