linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] LVM on a fake disk
@ 2007-05-29  7:08 Jordi Prats
  2007-05-29  7:36 ` David Robinson
  0 siblings, 1 reply; 3+ messages in thread
From: Jordi Prats @ 2007-05-29  7:08 UTC (permalink / raw)
  To: linux-lvm

Hi all,
How can I define voluem groups and logical volumes using a disk image on 
a file that will be the root filesystem of another machine (not the one 
that is defining them)?

I want to do this to create a Xen guest.

Thanks,
Jordi

-- 
......................................................................
         __
        / /          Jordi Prats
  C E / S / C A      Dept. de Sistemes
      /_/            Centre de Supercomputaci� de Catalunya

  Gran Capit�, 2-4 (Edifici Nexus) � 08034 Barcelona
  T. 93 205 6464 � F.  93 205 6979 � jprats@cesca.es
...................................................................... 

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

* Re: [linux-lvm] LVM on a fake disk
  2007-05-29  7:08 [linux-lvm] LVM on a fake disk Jordi Prats
@ 2007-05-29  7:36 ` David Robinson
  2007-05-29 20:40   ` Jordi Prats
  0 siblings, 1 reply; 3+ messages in thread
From: David Robinson @ 2007-05-29  7:36 UTC (permalink / raw)
  To: LVM general discussion and development

Jordi Prats wrote:
> Hi all,
> How can I define voluem groups and logical volumes using a disk image on 
> a file that will be the root filesystem of another machine (not the one 
> that is defining them)?

The link below provides some details which may help. You can use losetup 
to associate a loop device with a regular file, then treat it as you 
would to a normal block device.

http://fedoraproject.org/wiki/Docs/Fedora7VirtQuickStart#head-498c8bbe74fd334cf63a4f1f918be74c726238dd

ie:

# create a sparse file to use as the block device in the guest
dd if=/dev/zero of=disk1.img seek=8096 bs=1M count=0

# setup a loopback device
losetup /dev/loop0 disk1.img

/dev/loop0 can now be used like a normal block device. If you partition 
the device thou it's slightly different - you need to use kpartx to make 
the partitions usable.

ie:

# create a partition table on the device (/boot cannot be on an LVM volume)
fdisk /dev/loop0

# make the partitions visible (they will appear as /dev/mapper/loop0pX, 
where X is a partition number)
kpartx -a /dev/loop0

# then you can use LVM on the devices
pvcreate /dev/mapper/loop0p1

The LVM's point of view there is nothing special that needs to be done 
other than scanning for the volume groups (vgscan) and 
activating/deactivating them (vgchange -ay <vg>/ vgchange -an <vg>).

Dave

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

* Re: [linux-lvm] LVM on a fake disk
  2007-05-29  7:36 ` David Robinson
@ 2007-05-29 20:40   ` Jordi Prats
  0 siblings, 0 replies; 3+ messages in thread
From: Jordi Prats @ 2007-05-29 20:40 UTC (permalink / raw)
  To: LVM general discussion and development

Thank you! I did it this way and it worked perfectly!

Jordi

David Robinson wrote:
> Jordi Prats wrote:
>> Hi all,
>> How can I define voluem groups and logical volumes using a disk image
>> on a file that will be the root filesystem of another machine (not the
>> one that is defining them)?
> 
> The link below provides some details which may help. You can use losetup
> to associate a loop device with a regular file, then treat it as you
> would to a normal block device.
> 
> http://fedoraproject.org/wiki/Docs/Fedora7VirtQuickStart#head-498c8bbe74fd334cf63a4f1f918be74c726238dd
> 
> 
> ie:
> 
> # create a sparse file to use as the block device in the guest
> dd if=/dev/zero of=disk1.img seek=8096 bs=1M count=0
> 
> # setup a loopback device
> losetup /dev/loop0 disk1.img
> 
> /dev/loop0 can now be used like a normal block device. If you partition
> the device thou it's slightly different - you need to use kpartx to make
> the partitions usable.
> 
> ie:
> 
> # create a partition table on the device (/boot cannot be on an LVM volume)
> fdisk /dev/loop0
> 
> # make the partitions visible (they will appear as /dev/mapper/loop0pX,
> where X is a partition number)
> kpartx -a /dev/loop0
> 
> # then you can use LVM on the devices
> pvcreate /dev/mapper/loop0p1
> 
> The LVM's point of view there is nothing special that needs to be done
> other than scanning for the volume groups (vgscan) and
> activating/deactivating them (vgchange -ay <vg>/ vgchange -an <vg>).
> 
> Dave
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
> 
> 

-- 
......................................................................
        __
       / /          Jordi Prats Catal�
 C E / S / C A      Departament de Sistemes
     /_/            Centre de Supercomputaci� de Catalunya

 Gran Capit�, 2-4 (Edifici Nexus) � 08034 Barcelona
 T. 93 205 6464 � F.  93 205 6979 � jprats@cesca.es
......................................................................
pgp:0x5D0D1321
......................................................................

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

end of thread, other threads:[~2007-05-29 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29  7:08 [linux-lvm] LVM on a fake disk Jordi Prats
2007-05-29  7:36 ` David Robinson
2007-05-29 20:40   ` Jordi Prats

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