linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvm partition on lv
@ 2006-08-08  1:17 Randall Smith
  2006-08-08 10:34 ` Markus Laire
  2006-08-14  4:42 ` Randall Smith
  0 siblings, 2 replies; 5+ messages in thread
From: Randall Smith @ 2006-08-08  1:17 UTC (permalink / raw)
  To: linux-lvm

Warning:  This may be insane.

I like the flexibility of LVM and try to use it wherever it's feasible. 
  In this case, I'd like a Xen guest OS to have control over it's LV's. 
  The method I usually see for using LVM with Xen is to create an LV and 
a filesystem on it.  I would like to instead create an LV and partition 
it with an LVM partition and maybe other partition types.  Just to test 
this I did the following:

1. lvcreate -L 100M -name test vg1
2. cfdisk /dev/vg1/test
3. create LVM partition on entire device
4. pvcreate /dev/vg1/test
5. vgcreate vg2 /dev/vg1/test
6. vgchange -ay /dev/vg2
7. lvcreate -L 50M -n testlv vg2
8. mkfs.ext3 /dev/vg2/testlv
9. mkdir /mnt/test
10. mount /dev/vg2/testlv /mnt/test

And it worked!  Cool!

Let's say on /dev/vg1/test I had one LVM partition and one ext3 
partition.  How can I access those separate partitions since it's only 
one device (/dev/vg1/test)?  Normally, a partitioned block device 
(/dev/hda) would show up like /dev/hda1, dev/hda2, etc.

In the example above, I'm partitioning the LV and using the partition on 
the same system, which is useless.  What I will be doing is giving the 
disk image /dev/vg1/test to a Xen guest so it can have it's own VG and 
LVs.  Are there potential problems I should look out for and/or tweaking 
I should do to make this work optimally?

Randall

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

* Re: [linux-lvm] lvm partition on lv
  2006-08-08  1:17 [linux-lvm] lvm partition on lv Randall Smith
@ 2006-08-08 10:34 ` Markus Laire
  2006-08-08 10:40   ` Markus Laire
  2006-08-14  4:42 ` Randall Smith
  1 sibling, 1 reply; 5+ messages in thread
From: Markus Laire @ 2006-08-08 10:34 UTC (permalink / raw)
  To: LVM general discussion and development

On 8/8/06, Randall Smith <randall@tnr.cc> wrote:
> Let's say on /dev/vg1/test I had one LVM partition and one ext3
> partition.  How can I access those separate partitions since it's only
> one device (/dev/vg1/test)?  Normally, a partitioned block device
> (/dev/hda) would show up like /dev/hda1, dev/hda2, etc.

With loop-device, you can use only part of the block-device as new
block-device (See options -o and -s in man:losetup)

So if you know the positions where the partitions start, and their
lengths (both in bytes), you could do something like this: (I havn't
tested this, so there might be some errors in these commands. But the
basic idea should work)

# make LVM partition available at /dev/loop1
losetup -o $lvm_start -s $lvm_size /dev/loop1 /dev/vg1/test
mkdir /mnt/test
# Mount ext3-partition at /mnt/test using loop-device
mount -t ext3 -o offset=$ext3_start,sizelimit=$ext3_length
/dev/vg1/test /mnt/test

-- 
Markus Laire

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

* Re: [linux-lvm] lvm partition on lv
  2006-08-08 10:34 ` Markus Laire
@ 2006-08-08 10:40   ` Markus Laire
  2006-08-08 14:27     ` [linux-lvm] " Randall Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Laire @ 2006-08-08 10:40 UTC (permalink / raw)
  To: LVM general discussion and development

On 8/8/06, Markus Laire <malaire@gmail.com> wrote:
> On 8/8/06, Randall Smith <randall@tnr.cc> wrote:
> > Let's say on /dev/vg1/test I had one LVM partition and one ext3
> > partition.  How can I access those separate partitions since it's only
> > one device (/dev/vg1/test)?  Normally, a partitioned block device
> > (/dev/hda) would show up like /dev/hda1, dev/hda2, etc.
>
> With loop-device, you can use only part of the block-device as new
> block-device (See options -o and -s in man:losetup)
>
> So if you know the positions where the partitions start, and their
> lengths (both in bytes), you could do something like this: (I havn't
> tested this, so there might be some errors in these commands. But the
> basic idea should work)
>
> # make LVM partition available at /dev/loop1
> losetup -o $lvm_start -s $lvm_size /dev/loop1 /dev/vg1/test
> mkdir /mnt/test
> # Mount ext3-partition at /mnt/test using loop-device
> mount -t ext3 -o offset=$ext3_start,sizelimit=$ext3_length
> /dev/vg1/test /mnt/test

Well, last command is missing at least "loop" option - i.e. it should be

mount -t ext3 -o loop,offset=$ext3_start,sizelimit=$ext3_length
/dev/vg1/test /mnt/test

or you could use these instead
losetup -o $ext3_start -s $ext3_length /dev/loop2 /dev/vg1/test
mount -t ext3 /dev/loop2 /mnt/test

I hope I didn't make other mistakes...

($lvm_size and $ext3_length both means the size of the partition in
bytes - I should've used 'size' or 'length' for both for consistency)

-- 
Markus Laire

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

* [linux-lvm] Re: lvm partition on lv
  2006-08-08 10:40   ` Markus Laire
@ 2006-08-08 14:27     ` Randall Smith
  0 siblings, 0 replies; 5+ messages in thread
From: Randall Smith @ 2006-08-08 14:27 UTC (permalink / raw)
  To: linux-lvm

Markus Laire wrote:
> On 8/8/06, Markus Laire <malaire@gmail.com> wrote:
> 
>> On 8/8/06, Randall Smith <randall@tnr.cc> wrote:
>> > Let's say on /dev/vg1/test I had one LVM partition and one ext3
>> > partition.  How can I access those separate partitions since it's only
>> > one device (/dev/vg1/test)?  Normally, a partitioned block device
>> > (/dev/hda) would show up like /dev/hda1, dev/hda2, etc.
>>
>> With loop-device, you can use only part of the block-device as new
>> block-device (See options -o and -s in man:losetup)
>>
>> So if you know the positions where the partitions start, and their
>> lengths (both in bytes), you could do something like this: (I havn't
>> tested this, so there might be some errors in these commands. But the
>> basic idea should work)
>>
>> # make LVM partition available at /dev/loop1
>> losetup -o $lvm_start -s $lvm_size /dev/loop1 /dev/vg1/test
>> mkdir /mnt/test
>> # Mount ext3-partition at /mnt/test using loop-device
>> mount -t ext3 -o offset=$ext3_start,sizelimit=$ext3_length
>> /dev/vg1/test /mnt/test
> 
> 
> Well, last command is missing at least "loop" option - i.e. it should be
> 
> mount -t ext3 -o loop,offset=$ext3_start,sizelimit=$ext3_length
> /dev/vg1/test /mnt/test
> 
> or you could use these instead
> losetup -o $ext3_start -s $ext3_length /dev/loop2 /dev/vg1/test
> mount -t ext3 /dev/loop2 /mnt/test
> 
> I hope I didn't make other mistakes...
> 
> ($lvm_size and $ext3_length both means the size of the partition in
> bytes - I should've used 'size' or 'length' for both for consistency)
> 
Thanks.  That's perfect.

Working with Unix is so much fun.  It always seems that anything is 
possible as long as I'm willing to learn something new.

Randall

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

* [linux-lvm] Re: lvm partition on lv
  2006-08-08  1:17 [linux-lvm] lvm partition on lv Randall Smith
  2006-08-08 10:34 ` Markus Laire
@ 2006-08-14  4:42 ` Randall Smith
  1 sibling, 0 replies; 5+ messages in thread
From: Randall Smith @ 2006-08-14  4:42 UTC (permalink / raw)
  To: linux-lvm

Randall Smith wrote:
> Warning:  This may be insane.
> 
> I like the flexibility of LVM and try to use it wherever it's feasible. 
>  In this case, I'd like a Xen guest OS to have control over it's LV's. 
>  The method I usually see for using LVM with Xen is to create an LV and 
> a filesystem on it.  I would like to instead create an LV and partition 
> it with an LVM partition and maybe other partition types.  Just to test 
> this I did the following:
> 
> 1. lvcreate -L 100M -name test vg1
> 2. cfdisk /dev/vg1/test
> 3. create LVM partition on entire device
> 4. pvcreate /dev/vg1/test
> 5. vgcreate vg2 /dev/vg1/test
> 6. vgchange -ay /dev/vg2
> 7. lvcreate -L 50M -n testlv vg2
> 8. mkfs.ext3 /dev/vg2/testlv
> 9. mkdir /mnt/test
> 10. mount /dev/vg2/testlv /mnt/test
> 
> And it worked!  Cool!
> 
> Let's say on /dev/vg1/test I had one LVM partition and one ext3 
> partition.  How can I access those separate partitions since it's only 
> one device (/dev/vg1/test)?  Normally, a partitioned block device 
> (/dev/hda) would show up like /dev/hda1, dev/hda2, etc.
> 
> In the example above, I'm partitioning the LV and using the partition on 
> the same system, which is useless.  What I will be doing is giving the 
> disk image /dev/vg1/test to a Xen guest so it can have it's own VG and 
> LVs.  Are there potential problems I should look out for and/or tweaking 
> I should do to make this work optimally?
> 

/dev/vg1/test is used as a disk for the Xen guest OS.  The guest then 
recognizes vg2 on /dev/vg1/test.  By default, the host will also 
recognize and activate vg2.  Is there a problem with this and should I 
somehow configure the host not to activate vg2?  I know this may be 
confusing, but it's very useful.  I actually have it working now with 
several LVs on vg2.  So I've got PV->VG->LV->PV->VG-(LVs).

Randall

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

end of thread, other threads:[~2006-08-14  4:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-08  1:17 [linux-lvm] lvm partition on lv Randall Smith
2006-08-08 10:34 ` Markus Laire
2006-08-08 10:40   ` Markus Laire
2006-08-08 14:27     ` [linux-lvm] " Randall Smith
2006-08-14  4:42 ` Randall Smith

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