All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] Copying a raw disk image to LVM2
@ 2016-07-08 15:52 Brian McCullough
  2016-07-09 12:23 ` Марк Коренберг
  2016-07-09 17:00 ` Digimer
  0 siblings, 2 replies; 7+ messages in thread
From: Brian McCullough @ 2016-07-08 15:52 UTC (permalink / raw)
  To: LVM general discussion and development


I have been hunting for some time over the past couple of days, and find
several documentss that talk about converting from an LVM2 volume to a
raw disk image for Xen, but nothing about the reverse.

I have a VHD disk file that I would like to put on to an LVM2 volume,
like my other DomU guests.

I can see using dd, but am concerned about overwriting the LVM2 header.


Does anybody have any suggestions?


Thanks,
Brian

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

* Re: [linux-lvm] Copying a raw disk image to LVM2
  2016-07-08 15:52 [linux-lvm] Copying a raw disk image to LVM2 Brian McCullough
@ 2016-07-09 12:23 ` Марк Коренберг
  2016-07-09 17:00 ` Digimer
  1 sibling, 0 replies; 7+ messages in thread
From: Марк Коренберг @ 2016-07-09 12:23 UTC (permalink / raw)
  To: LVM general discussion and development

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

If you write from disk image to virtual LVM device, you will never
overwrite LVM metadata. The most convenient way to copy VM image is using
qemu-img, since it may not copy unallocated places of VM image, leaving it
uninitialized in LVM, which is significantly faster.

2016-07-08 20:52 GMT+05:00 Brian McCullough <bdmc@bdmcc-us.com>:

>
> I have been hunting for some time over the past couple of days, and find
> several documentss that talk about converting from an LVM2 volume to a
> raw disk image for Xen, but nothing about the reverse.
>
> I have a VHD disk file that I would like to put on to an LVM2 volume,
> like my other DomU guests.
>
> I can see using dd, but am concerned about overwriting the LVM2 header.
>
>
> Does anybody have any suggestions?
>
>
> Thanks,
> Brian
>
>
> _______________________________________________
> 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/
>



-- 
Segmentation fault

[-- Attachment #2: Type: text/html, Size: 1712 bytes --]

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

* Re: [linux-lvm] Copying a raw disk image to LVM2
  2016-07-08 15:52 [linux-lvm] Copying a raw disk image to LVM2 Brian McCullough
  2016-07-09 12:23 ` Марк Коренберг
@ 2016-07-09 17:00 ` Digimer
  2016-07-09 17:33   ` Марк Коренберг
  1 sibling, 1 reply; 7+ messages in thread
From: Digimer @ 2016-07-09 17:00 UTC (permalink / raw)
  To: LVM general discussion and development

On 08/07/16 11:52 AM, Brian McCullough wrote:
> 
> I have been hunting for some time over the past couple of days, and find
> several documentss that talk about converting from an LVM2 volume to a
> raw disk image for Xen, but nothing about the reverse.
> 
> I have a VHD disk file that I would like to put on to an LVM2 volume,
> like my other DomU guests.
> 
> I can see using dd, but am concerned about overwriting the LVM2 header.
> 
> 
> Does anybody have any suggestions?

I've done this with KVM before just fine. The LV metadata won't be
overwritten when you write to the actual LV. So this would work fine;

dd if=/path/to/image.raw of=/dev/vg0/lv_foo bs=4M; sync

Then just change your server's definition to point at the LV instead of
the raw file and voila.

-- 
Digimer
Papers and Projects: https://alteeve.ca/w/
What if the cure for cancer is trapped in the mind of a person without
access to education?

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

* Re: [linux-lvm] Copying a raw disk image to LVM2
  2016-07-09 17:00 ` Digimer
@ 2016-07-09 17:33   ` Марк Коренберг
  2016-07-09 20:25     ` Brian McCullough
  2016-07-10 22:02     ` emmanuel segura
  0 siblings, 2 replies; 7+ messages in thread
From: Марк Коренберг @ 2016-07-09 17:33 UTC (permalink / raw)
  To: LVM general discussion and development

One note: `sync` does not syncs written data, since it affects only
data, written through filesystem. You should use `dd ....
conv=fdatasync` instead.

2016-07-09 22:00 GMT+05:00 Digimer <lists@alteeve.ca>:
> On 08/07/16 11:52 AM, Brian McCullough wrote:
>>
>> I have been hunting for some time over the past couple of days, and find
>> several documentss that talk about converting from an LVM2 volume to a
>> raw disk image for Xen, but nothing about the reverse.
>>
>> I have a VHD disk file that I would like to put on to an LVM2 volume,
>> like my other DomU guests.
>>
>> I can see using dd, but am concerned about overwriting the LVM2 header.
>>
>>
>> Does anybody have any suggestions?
>
> I've done this with KVM before just fine. The LV metadata won't be
> overwritten when you write to the actual LV. So this would work fine;
>
> dd if=/path/to/image.raw of=/dev/vg0/lv_foo bs=4M; sync
>
> Then just change your server's definition to point at the LV instead of
> the raw file and voila.
>
> --
> Digimer
> Papers and Projects: https://alteeve.ca/w/
> What if the cure for cancer is trapped in the mind of a person without
> access to education?
>
> _______________________________________________
> 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/



-- 
Segmentation fault

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

* Re: [linux-lvm] Copying a raw disk image to LVM2
  2016-07-09 17:33   ` Марк Коренберг
@ 2016-07-09 20:25     ` Brian McCullough
  2016-07-10 22:02     ` emmanuel segura
  1 sibling, 0 replies; 7+ messages in thread
From: Brian McCullough @ 2016-07-09 20:25 UTC (permalink / raw)
  To: LVM general discussion and development

On Sat, Jul 09, 2016 at 10:33:51PM +0500, ???????? ?????????????????? wrote:
> One note: `sync` does not syncs written data, since it affects only
> data, written through filesystem. You should use `dd ....
> conv=fdatasync` instead.

Thank you both.

This is essentially the answer that I got from the Xen group, as well,
so I went ahead and tried it.  No problems.


Brian

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

* Re: [linux-lvm] Copying a raw disk image to LVM2
  2016-07-09 17:33   ` Марк Коренберг
  2016-07-09 20:25     ` Brian McCullough
@ 2016-07-10 22:02     ` emmanuel segura
  2016-07-11  7:32       ` Xen
  1 sibling, 1 reply; 7+ messages in thread
From: emmanuel segura @ 2016-07-10 22:02 UTC (permalink / raw)
  To: LVM general discussion and development

the lvm metadata is stored in the begining of the physical volume, the
logical volume is simple block device, so using dd you don't overwrite
any lvm header.

2016-07-09 19:33 GMT+02:00 Марк Коренберг <socketpair@gmail.com>:
> One note: `sync` does not syncs written data, since it affects only
> data, written through filesystem. You should use `dd ....
> conv=fdatasync` instead.
>
> 2016-07-09 22:00 GMT+05:00 Digimer <lists@alteeve.ca>:
>> On 08/07/16 11:52 AM, Brian McCullough wrote:
>>>
>>> I have been hunting for some time over the past couple of days, and find
>>> several documentss that talk about converting from an LVM2 volume to a
>>> raw disk image for Xen, but nothing about the reverse.
>>>
>>> I have a VHD disk file that I would like to put on to an LVM2 volume,
>>> like my other DomU guests.
>>>
>>> I can see using dd, but am concerned about overwriting the LVM2 header.
>>>
>>>
>>> Does anybody have any suggestions?
>>
>> I've done this with KVM before just fine. The LV metadata won't be
>> overwritten when you write to the actual LV. So this would work fine;
>>
>> dd if=/path/to/image.raw of=/dev/vg0/lv_foo bs=4M; sync
>>
>> Then just change your server's definition to point at the LV instead of
>> the raw file and voila.
>>
>> --
>> Digimer
>> Papers and Projects: https://alteeve.ca/w/
>> What if the cure for cancer is trapped in the mind of a person without
>> access to education?
>>
>> _______________________________________________
>> 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/
>
>
>
> --
> Segmentation fault
>
> _______________________________________________
> 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/



-- 
  .~.
  /V\
 //  \\
/(   )\
^`~'^

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

* Re: [linux-lvm] Copying a raw disk image to LVM2
  2016-07-10 22:02     ` emmanuel segura
@ 2016-07-11  7:32       ` Xen
  0 siblings, 0 replies; 7+ messages in thread
From: Xen @ 2016-07-11  7:32 UTC (permalink / raw)
  To: LVM general discussion and development

emmanuel segura schreef op 11-07-2016 0:02:

> the lvm metadata is stored in the begining of the physical volume, the
> logical volume is simple block device, so using dd you don't overwrite
> any lvm header.

I must say I did experience something weird when copying a LUKS 
partition (encrypted).

Apparently LUKS stores information about the device it is on (or was 
one) because I coudln't get it to re-adjust to a larger volume.

cryptsetup resize is supposed to resize to the size of the underlying 
block device.

I had to recreate my LUKS container before it would recognise the new 
size.

E.g. I copied from 2GB volume to 3GB volume using dd.

LUKS kept thinking it was still on a 2GB volume.

So resize didn't work and I could manually resize it to 3GB but 
automatic resize would resize it back to 2GB.

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

end of thread, other threads:[~2016-07-11  7:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-08 15:52 [linux-lvm] Copying a raw disk image to LVM2 Brian McCullough
2016-07-09 12:23 ` Марк Коренберг
2016-07-09 17:00 ` Digimer
2016-07-09 17:33   ` Марк Коренберг
2016-07-09 20:25     ` Brian McCullough
2016-07-10 22:02     ` emmanuel segura
2016-07-11  7:32       ` Xen

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.