linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] pvcreate can't use entire disk?
@ 2006-01-23 22:02 f-lvm
  0 siblings, 0 replies; 8+ messages in thread
From: f-lvm @ 2006-01-23 22:02 UTC (permalink / raw)
  To: linux-lvm; +Cc: f-lvm

[Please keep me CC'ed.  Tnx.]

I've been using LVM2 under Ubuntu Breezy for several months now; the
original partitioning & volume groups were created by its installer.
I've just decided to add a second disk, and I'm having problems with
what should have been the simplest step, namely pvcreate.

My new disk is /dev/hdd.  But doing "pvcreate /dev/hdd" complains
"Device /dev/hdd not found."  The disk is surely online:  I can
do, e.g., "strings /dev/hdd | head -1" and get "LILO" because this
disk was originally a random non-LVM'ed disk from another machine.
I would have -expected- pvcreate to complain about a partition table
existing (at which point I would have zeroed it and tried again), but
not to complain that the entire disk doesn't exist.

What's the problem here?  I'd rather not have to repartition the
(several) partions on the device into one, and then use just that
single partition, when I logically wanted the entire disk to just be
part of my VG.  (Though if that's the only way to get pvcreate to
behave, I can do so.)  But the howto at tldp.org very clearly states
that this should just work (it uses /dev/hdb as its example; but that
shouldn't matter :), and the manpage for pvcreate both talks about
whole disks, and includes whole disks in its example at the end.

What's the problem here?  What should I do?  Thanks!

P.S.  pvcreate --version claims LVM version 2.01.04 (2005-02-09),
library version 1.01.03 (2005-06-13), and driver version 4.4.0.

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

* [linux-lvm] pvcreate can't use entire disk?
@ 2006-01-23 22:26 f-lvm
  2006-01-23 22:35 ` Alasdair G Kergon
  0 siblings, 1 reply; 8+ messages in thread
From: f-lvm @ 2006-01-23 22:26 UTC (permalink / raw)
  To: linux-lvm; +Cc: f-lvm

I've been using LVM2 under Ubuntu Breezy for several months now; the
original partitioning & volume groups were created by its installer.
I've just decided to add a second disk, and I'm having problems with
what should have been the simplest step, namely pvcreate.

My new disk is /dev/hdd.  But doing "pvcreate /dev/hdd" complains
"Device /dev/hdd not found."  The disk is surely online:  I can
do, e.g., "strings /dev/hdd | head -1" and get "LILO" because this
disk was originally a random non-LVM'ed disk from another machine.
I would have -expected- pvcreate to complain about a partition table
existing (at which point I would have zeroed it and tried again), but
not to complain that the entire disk doesn't exist.

What's the problem here?  I'd rather not have to repartition the
(several) partions on the device into one, and then use just that
single partition, when I logically wanted the entire disk to just be
part of my VG.  (Though if that's the only way to get pvcreate to
behave, I can do so.)  But the howto at tldp.org very clearly states
that this should just work (it uses /dev/hdb as its example; but that
shouldn't matter :), and the manpage for pvcreate both talks about
whole disks, and includes whole disks in its example at the end.

So what should I do?  Thanks!

P.S.  pvcreate --version claims LVM version 2.01.04 (2005-02-09),
library version 1.01.03 (2005-06-13), and driver version 4.4.0.

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

* Re: [linux-lvm] pvcreate can't use entire disk?
  2006-01-23 22:26 [linux-lvm] pvcreate can't use entire disk? f-lvm
@ 2006-01-23 22:35 ` Alasdair G Kergon
  2006-01-23 23:02   ` f-lvm
  2006-01-23 23:12   ` [linux-lvm] pvcreate can't use entire disk? Karl O. Pinc
  0 siblings, 2 replies; 8+ messages in thread
From: Alasdair G Kergon @ 2006-01-23 22:35 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: f-lvm

On Mon, Jan 23, 2006 at 05:26:00PM -0500, f-lvm@media.mit.edu wrote:
> "Device /dev/hdd not found."  The disk is surely online:  I can

> I would have -expected- pvcreate to complain about a partition table
> existing 

The currrent internal structure of LVM2 makes that difficult.
Add -vvvv to commands for more information like that.

Invalid devices are filtered out at a low level in the libraries
so tools such as 'pvcreate' never see them.

If your disk has a partition table, then LVM2 insists you use those
partitions to reduce the risk of accidents.
 
> (at which point I would have zeroed it and tried again)

Did you try that?
(And then you might need to run 'vgscan'.)

Alasdair
-- 
agk@redhat.com

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

* [linux-lvm] pvcreate can't use entire disk?
  2006-01-23 22:35 ` Alasdair G Kergon
@ 2006-01-23 23:02   ` f-lvm
  2006-01-24 14:55     ` AJ Lewis
  2006-01-23 23:12   ` [linux-lvm] pvcreate can't use entire disk? Karl O. Pinc
  1 sibling, 1 reply; 8+ messages in thread
From: f-lvm @ 2006-01-23 23:02 UTC (permalink / raw)
  To: linux-lvm; +Cc: aj, f-lvm

    Date: Mon, 23 Jan 2006 22:35:16 +0000
    From: Alasdair G Kergon <agk@redhat.com>

    On Mon, Jan 23, 2006 at 05:26:00PM -0500, f-lvm@media.mit.edu wrote:
    > "Device /dev/hdd not found."  The disk is surely online:  I can

    > I would have -expected- pvcreate to complain about a partition table
    > existing 

    The currrent internal structure of LVM2 makes that difficult.
    Add -vvvv to commands for more information like that.

    Invalid devices are filtered out at a low level in the libraries
    so tools such as 'pvcreate' never see them.

    If your disk has a partition table, then LVM2 insists you use those
    partitions to reduce the risk of accidents.

Ah.  That's directly contrary to the LVM2 howto at
http://www.tldp.org/HOWTO/LVM-HOWTO/initdisks.html,
which says, "If you get an error that LVM can't initialize
a disk with a partition table on it, ..." etc.

The manpage also doesn't claim that not erasing an existing partition
table will cause pvcreate to simply fail as if the hardware is
offline---pvcreate should warn!  (And, as if obvious from -vvvv (which
is -also- undocumented!  Only -v and --verbose are documented, but not
their repetition to get more info), pvcreate knew damned well what was
going on---but didn't tell -me-.  Well, okay, maybe some library
beneath pvcreate knew and didn't tell pvcreate, but in that case,
we certainly had incomplete and/or misleading documentation in two
places.)

Is this a problem with pvcreate in its original instantiation, or with
a Debian version, or with Ubuntu?  I'm planning on bugreporting this
to Ubuntu anyway, but it'd be nice if it made its way upstream as
expeditiously as possible.  (And I'm CC'ing the HOWTO author
directly.)

[And why was I in this situation?  Because I'm -very- cautious about
things that might wipe entire disks, and I wanted to verify that
pvcreate failed as documented before giving it the go-ahead.
Apparently, though, the documentation mislead me...]

Anyway, thanks!

    > (at which point I would have zeroed it and tried again)

    Did you try that?
    (And then you might need to run 'vgscan'.)

Yes, I tried zeroing the first 1k, and -now- pvcreate apparently works
fine.  vgscan only returned my original VG, but that makes sense,
since I haven't tried to actually instantiate a VG on the new disk
yet.  Transcripts of failing and working case below:

~# pvcreate /dev/hdd
  Device /dev/hdd not found.

~# strings /dev/hdd | head -1
LILO

~# dd if=/dev/hdd bs=512 count=1
[ . . . random garbage deleted so it won't gronk your mailreader . . . ]
1+0 records in
1+0 records out
512 bytes transferred in 0.000133 seconds (3846551 bytes/sec)

~# pvcreate --version
  LVM version:     2.01.04 (2005-02-09)
  Library version: 1.01.03 (2005-06-13)
  Driver version:  4.4.0

~# pvcreate -vvvv /dev/hdd
#lvmcmdline.c:835         Processing: pvcreate -vvvv /dev/hdd
#lvmcmdline.c:838         O_DIRECT will be used
#config/config.c:773       Setting global/locking_type to 1
#config/config.c:758       Setting global/locking_dir to /var/lock/lvm
#locking/locking.c:137       File-based locking enabled.
#locking/file_locking.c:162       Locking /var/lock/lvm/P_orphans WB
#device/dev-cache.c:206         /dev/hdd: Added to device cache
#device/dev-io.c:376         Opened /dev/hdd RO
#device/dev-io.c:250       /dev/hdd: size is 390721968 sectors
#device/dev-io.c:308         WARNING: /dev/hdd already opened read-only
#device/dev-io.c:407         Closed /dev/hdd
#device/dev-io.c:376         Opened /dev/hdd RW
#device/dev-io.c:134         /dev/hdd: block size is 4096 bytes
#filters/filter.c:109         /dev/hdd: Skipping: Partition table signature found
#metadata/metadata.c:834         <backtrace>
#filters/filter-persistent.c:216         /dev/hdd: Skipping (cached)
#pvcreate.c:81   Device /dev/hdd not found.
#locking/file_locking.c:59       Unlocking /var/lock/lvm/P_orphans
#device/dev-io.c:407         Closed /dev/hdd

~# dd if=/dev/hdd of=hdd.1k bs=1k count=1
1+0 records in
1+0 records out
1024 bytes transferred in 0.004259 seconds (240427 bytes/sec)

~# dd if=/dev/zero of=/dev/hdd bs=1k count=1
1+0 records in
1+0 records out
1024 bytes transferred in 0.000137 seconds (7478965 bytes/sec)

~# blockdev --rereadpt /dev/hdd

~# pvcreate -vvvv /dev/hdd
#lvmcmdline.c:835         Processing: pvcreate -vvvv /dev/hdd
#lvmcmdline.c:838         O_DIRECT will be used
#config/config.c:773       Setting global/locking_type to 1
#config/config.c:758       Setting global/locking_dir to /var/lock/lvm
#locking/locking.c:137       File-based locking enabled.
#locking/file_locking.c:162       Locking /var/lock/lvm/P_orphans WB
#device/dev-cache.c:206         /dev/hdd: Added to device cache
#device/dev-io.c:376         Opened /dev/hdd RO
#device/dev-io.c:250       /dev/hdd: size is 390721968 sectors
#device/dev-io.c:308         WARNING: /dev/hdd already opened read-only
#device/dev-io.c:407         Closed /dev/hdd
#device/dev-io.c:376         Opened /dev/hdd RW
#device/dev-io.c:134         /dev/hdd: block size is 4096 bytes
#filters/filter-composite.c:31         Using /dev/hdd
#label/label.c:186       /dev/hdd: No label detected
#label/label.c:278         <backtrace>
#device/dev-io.c:250       /dev/hdd: size is 390721968 sectors
#config/config.c:778       metadata/pvmetadatasize not found in config: defaulting to 255
#config/config.c:778       metadata/pvmetadatacopies not found in config: defaulting to 1
#device/dev-io.c:250       /dev/hdd: size is 390721968 sectors
#device/dev-io.c:535         Wiping /dev/hdd at sector 4 length 8 sectors
#pvcreate.c:207     Set up physical volume for "/dev/hdd" with 390721584 available sectors
#label/label.c:209       Scanning for labels to wipe from /dev/hdd
#pvcreate.c:216     Zeroing start of device /dev/hdd
#device/dev-io.c:535         Wiping /dev/hdd at sector 0 length 4 sectors
#pvcreate.c:227       Writing physical volume data to disk "/dev/hdd"
#format_text/format-text.c:1039         Creating metadata area on /dev/hdd at sector 4 size 380 sectors
#label/label.c:326       /dev/hdd: Writing label to sector 1
  Physical volume "/dev/hdd" successfully created
#locking/file_locking.c:59       Unlocking /var/lock/lvm/P_orphans
#device/dev-io.c:407         Closed /dev/hdd

~# 

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

* Re: [linux-lvm] pvcreate can't use entire disk?
  2006-01-23 22:35 ` Alasdair G Kergon
  2006-01-23 23:02   ` f-lvm
@ 2006-01-23 23:12   ` Karl O. Pinc
  1 sibling, 0 replies; 8+ messages in thread
From: Karl O. Pinc @ 2006-01-23 23:12 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: f-lvm


On 01/23/2006 04:35:16 PM, Alasdair G Kergon wrote:
> On Mon, Jan 23, 2006 at 05:26:00PM -0500, f-lvm@media.mit.edu wrote:

> > (at which point I would have zeroed it and tried again)
> 
> Did you try that?

I would find this a bit annoying.  I just put a 300GB disk into
an old slow machine and found it took over 12 hours to zero.

While zeroing the early part of the disk would probably be
adequate, it'd be nice if there was some sort of force option.


Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein

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

* Re: [linux-lvm] pvcreate can't use entire disk?
  2006-01-23 23:02   ` f-lvm
@ 2006-01-24 14:55     ` AJ Lewis
  2006-01-24 18:45       ` f-lvm
  0 siblings, 1 reply; 8+ messages in thread
From: AJ Lewis @ 2006-01-24 14:55 UTC (permalink / raw)
  To: f-lvm; +Cc: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]


On Jan 23, 2006, at 5:02 PM, f-lvm@media.mit.edu wrote:

>     Date: Mon, 23 Jan 2006 22:35:16 +0000
>     From: Alasdair G Kergon <agk@redhat.com>
>
>     On Mon, Jan 23, 2006 at 05:26:00PM -0500, f-lvm@media.mit.edu  
> wrote:
>> "Device /dev/hdd not found."  The disk is surely online:  I can
>
>> I would have -expected- pvcreate to complain about a partition table
>> existing
>
>     The currrent internal structure of LVM2 makes that difficult.
>     Add -vvvv to commands for more information like that.
>
>     Invalid devices are filtered out at a low level in the libraries
>     so tools such as 'pvcreate' never see them.
>
>     If your disk has a partition table, then LVM2 insists you use  
> those
>     partitions to reduce the risk of accidents.
>
> Ah.  That's directly contrary to the LVM2 howto at
> http://www.tldp.org/HOWTO/LVM-HOWTO/initdisks.html,
> which says, "If you get an error that LVM can't initialize
> a disk with a partition table on it, ..." etc.

Well, LVM1 would complain about the partition table.  I guess lvm2  
does not, but that doesn't change the fact that neither would let you  
write to a whole disk with a partition table on it.  I can update the  
howto to say that is the error to expect for lvm2 when trying to use  
a whole disk with a partition table on it.

Regards,
AJ

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

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

* [linux-lvm] pvcreate can't use entire disk?
  2006-01-24 14:55     ` AJ Lewis
@ 2006-01-24 18:45       ` f-lvm
  2006-01-24 18:53         ` [linux-lvm] how to use mirror function of lvcreate? Tom Callahan
  0 siblings, 1 reply; 8+ messages in thread
From: f-lvm @ 2006-01-24 18:45 UTC (permalink / raw)
  To: aj; +Cc: linux-lvm, f-lvm

    Date: Tue, 24 Jan 2006 08:55:41 -0600
    From: AJ Lewis <aj@terrascale.net>

    Well, LVM1 would complain about the partition table.  I guess lvm2  
    does not, but that doesn't change the fact that neither would let you  
    write to a whole disk with a partition table on it.  I can update the  
    howto to say that is the error to expect for lvm2 when trying to use  
    a whole disk with a partition table on it.

Thanks.  I've also filed a bug report with Ubuntu (since that's the
distribution I tested this under) asking if the error message can be
made less misleading; we'll see if they fix it, push it upstream, or
whatever.  (After all, running pvcreate on a disk with a partition
table on it---whether by accident or not---has to be the single most
common non-succeeding case; it'd be nice if the error message didn't
lie about it.  If I hadn't been so cautious [and if I hadn't realized
that pvcreate's error message is wrong in LVM2] I've had just wiped
the partition table to begin with and never been mislead in the first
place.)

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

* [linux-lvm] how to use mirror function of lvcreate?
  2006-01-24 18:45       ` f-lvm
@ 2006-01-24 18:53         ` Tom Callahan
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Callahan @ 2006-01-24 18:53 UTC (permalink / raw)
  To: LVM general discussion and development

There is a mirror flag that can be thrown during lvcreate. Anyone have
any documentation on how to do this?

I'd like to mirror an LV as I've read you can do.

Thanks,

Tom Callahan
TESSCO Technologies
Desk: (410)-229-1361
Cell: (443)-506-6216
Email: callahant@tessco.com

A real engineer only resorts to documentation when the keyboard dents on the forehead get too noticeable.

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

end of thread, other threads:[~2006-01-24 18:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-23 22:26 [linux-lvm] pvcreate can't use entire disk? f-lvm
2006-01-23 22:35 ` Alasdair G Kergon
2006-01-23 23:02   ` f-lvm
2006-01-24 14:55     ` AJ Lewis
2006-01-24 18:45       ` f-lvm
2006-01-24 18:53         ` [linux-lvm] how to use mirror function of lvcreate? Tom Callahan
2006-01-23 23:12   ` [linux-lvm] pvcreate can't use entire disk? Karl O. Pinc
  -- strict thread matches above, loose matches on Subject: below --
2006-01-23 22:02 f-lvm

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