[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] sector zero on a Logical Volume



On Monday 14 July 2008 06:34:08 Bryn M. Reeves wrote:
> Gene Czarcinski wrote:
> > 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.
>
> > 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.

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.

>
> 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.

>
> > 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]