All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] sector zero on a Logical Volume
@ 2008-07-13 21:51 Gene Czarcinski
  2008-07-14 10:34 ` Bryn M. Reeves
  0 siblings, 1 reply; 3+ messages in thread
From: Gene Czarcinski @ 2008-07-13 21:51 UTC (permalink / raw)
  To: linux-lvm

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] sector zero on a Logical Volume
  2008-07-13 21:51 [linux-lvm] sector zero on a Logical Volume Gene Czarcinski
@ 2008-07-14 10:34 ` Bryn M. Reeves
  2008-07-14 21:14   ` Gene Czarcinski
  0 siblings, 1 reply; 3+ messages in thread
From: Bryn M. Reeves @ 2008-07-14 10:34 UTC (permalink / raw)
  To: LVM general discussion and development

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

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.

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.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] sector zero on a Logical Volume
  2008-07-14 10:34 ` Bryn M. Reeves
@ 2008-07-14 21:14   ` Gene Czarcinski
  0 siblings, 0 replies; 3+ messages in thread
From: Gene Czarcinski @ 2008-07-14 21:14 UTC (permalink / raw)
  To: linux-lvm

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-14 21:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-13 21:51 [linux-lvm] sector zero on a Logical Volume Gene Czarcinski
2008-07-14 10:34 ` Bryn M. Reeves
2008-07-14 21:14   ` Gene Czarcinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.