All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Robinson <zxvdr.au@gmail.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] LVM on a fake disk
Date: Tue, 29 May 2007 17:36:30 +1000	[thread overview]
Message-ID: <465BD7FE.7080501@gmail.com> (raw)
In-Reply-To: <465BD163.4010904@cesca.es>

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

  reply	other threads:[~2007-05-29  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-29  7:08 [linux-lvm] LVM on a fake disk Jordi Prats
2007-05-29  7:36 ` David Robinson [this message]
2007-05-29 20:40   ` Jordi Prats

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=465BD7FE.7080501@gmail.com \
    --to=zxvdr.au@gmail.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.