Skip to contentSkip to conversation

copy lv from lv?

linux-lvm yue 4 participants 10 messages Mar 29, 2011 – Apr 5, 2011

lore
Share & tools
lore

yue

author
#0 lore raw

if lvm do not support lv copy? it is better copy on write. dd takes long time.

thanks

#1 lore raw
Quoted 2 lines

if lvm do not support lv copy? it is better copy on write. dd takes long time.

For a complete copy the only thing faster than "dd" is two copies of "dd" piped together. dd is basically limited by the speed of the physical disks, assuming proper arguments to dd. For a copy on write, that's called a snapshot. LVM COULD beused to copy, by making and splitting a mirror, but that's going to be a lot slower than dd. (Though a mirror and split can be used on a live filesystem, wth it unmounted only for an instant during the split).

Signature · 16 lines
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Tue, 29 Mar 2011 20:53:37 +0800 (CST)
Quoted 4 lines · yue

if lvm do not support lv copy? it is better copy on write. dd takes long time.

thanks

author
#2 lore raw

1..how to pipe two copy together
2.i take lv as xen-guestOS's disk. usually many guestOS created from one lv(called template), maybe many data is readonly, so if so many lvs share readonly part ,and have its private data? COW save disk space, and take less time.

i do not think snapshot is sutable for this case.

thanks

Quoted 40 lines · At 2011-03-30 01:48:14,"Ray Morris" <[email protected]> wrote:
Quoted 2 lines

if lvm do not support lv copy? it is better copy on write. dd takes long time.

For a complete copy the only thing faster than "dd" is two copies of "dd" piped together. dd is basically limited by the speed of the physical disks, assuming proper arguments to dd. For a copy on write, that's called a snapshot. LVM COULD beused to copy, by making and splitting a mirror, but that's going to be a lot slower than dd. (Though a mirror and split can be used on a live filesystem, wth it unmounted only for an instant during the split).

Signature · 16 lines
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Tue, 29 Mar 2011 20:53:37 +0800 (CST)
Quoted 4 lines · yue

if lvm do not support lv copy? it is better copy on write. dd takes long time.

thanks

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#3 lore raw
Quoted 1 line

1..how to pipe two copy together

This is what I use after some experimenting. I've found it's often far faster than the more obvious use of dd:

nice -5 dd if=/dev/clones/from bs=64M iflag=direct |
dd of=/dev/scratch/to bs=64M oflag=direct

I use 64 MB extents. For smaller extents, a matching dd block size might be good.

Quoted 5 lines

2.i take lv as xen-guestOS's disk. usually many guestOS created from one lv(called template), maybe many data is readonly, so if so many lvs share readonly part ,and have its private data? COW save disk space, and take less time. i do not think snapshot is sutable for this case. thanks

Some people use snapshots for that purpose. I'm not one of those people, so I don't know details, other than that it can be done.

If you are creating that template guest, meaning that you can choose the filesystem layout, etc., the most efficient but less flexible option may be to decide explicitly what's read only. The liveCD crowd has documented procedures gained from their experience in making most of the system read only. As a side benefit, such systems can't be rooted or screwed up in some ways, so there's a level of trust knowing the core system is "correct". Then you could mount the same image for the readonyl portions of many guests, while mounting "per guest" images for /home, /tmp, etc.

Signature · 16 lines
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Wed, 30 Mar 2011 21:49:21 +0800 (CST)
Quoted 52 lines · yue

1..how to pipe two copy together
2.i take lv as xen-guestOS's disk. usually many guestOS created from one lv(called template), maybe many data is readonly, so if so many lvs share readonly part ,and have its private data? COW save disk space, and take less time. i do not think snapshot is sutable for this case. thanks

Quoted 40 lines · At 2011-03-30 01:48:14,"Ray Morris" <[email protected]> wrote:
Quoted 2 lines

if lvm do not support lv copy? it is better copy on write. dd takes long time.

For a complete copy the only thing faster than "dd" is two copies of "dd" piped together. dd is basically limited by the speed of the physical disks, assuming proper arguments to dd. For a copy on write, that's called a snapshot. LVM COULD beused to copy, by making and splitting a mirror, but that's going to be a lot slower than dd. (Though a mirror and split can be used on a live filesystem, wth it unmounted only for an instant during the split).

Signature · 16 lines
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Tue, 29 Mar 2011 20:53:37 +0800 (CST)
Quoted 4 lines · yue

if lvm do not support lv copy? it is better copy on write. dd takes long time.

thanks

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#4 lore raw
Quoted 10 lines · Ray Morris
Quoted 1 line

1..how to pipe two copy together

This is what I use after some experimenting. I've found it's often far faster than the more obvious use of dd:

nice -5 dd if=/dev/clones/from bs=64M iflag=direct |
dd of=/dev/scratch/to bs=64M oflag=direct

I use 64 MB extents. For smaller extents, a matching dd block size might be good.

Thanks for that recipe. It ought to be in lvm2 as an lvcopy utility (dynamically determining extent size, etc).

Quoted 5 lines
Quoted 5 lines

2.i take lv as xen-guestOS's disk. usually many guestOS created from one lv(called template), maybe many data is readonly, so if so many lvs share readonly part ,and have its private data? COW save disk space, and take less time. i do not think snapshot is sutable for this case. thanks

As long as the origin is not often modified, having many snapshots
is efficient. Each write to the origin will of course entail a write
to each snapshot. (And as I discovered recently, if write barriers are
disabled or buggy at any hardware or software layer, a power failure during
heavy writes to the origin is particularly vulnerable to write reordering corrupting a snapshot. So make sure UPS is working before updating the origin.)

--

	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154

"Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial.

#5 lore raw

Dne 31.3.2011 02:27, Stuart D. Gathman napsal(a):

Quoted 7 lines · Ray Morris
Quoted 6 lines
Quoted 2 lines

1..how to pipe two copy together

This is what I use after some experimenting. I've found it's often far faster than the more obvious use of dd:

Quoted 9 lines
Quoted 5 lines

nice -5 dd if=/dev/clones/from bs=64M iflag=direct |
dd of=/dev/scratch/to bs=64M oflag=direct

I use 64 MB extents. For smaller extents, a matching dd block size might be good.

Thanks for that recipe. It ought to be in lvm2 as an lvcopy utility (dynamically determining extent size, etc).

Isn't this already done in a better way by 'dd' using 'zero' copy mechanism ?? (assuming it is already using either 'mmap()' -> 'write()' or 'splice()' as your proposed piped copy is doing a lot of pointless memory copies and cache trashing.

If it's still faster - then your kernel setting for buffering are most probaly not tuned for the best performance.

Zdenek

author
#9 lore raw
In reply to Stuart D. Gathman

1.what i mean is that, when copy one lv, i would like use it's snapshot, not origin, because origin is always template. making a snapshot is very quick.
but if can take a thousand snapshots from one lv, same size as origin? while the snapshots are readable and writable?

thanks
2.nice -5 dd if=/dev/clones/from bs=64M iflag=direct |
dd of=/dev/scratch/to bs=64M oflag=direct
the pipe base on STDIN,STDOUT. i do not think STDIN,STDOUT have too mush cache

Quoted 41 lines · At 2011-03-31 08:27:52,"Stuart D. Gathman" <[email protected]> wrote:
Quoted 10 lines · Ray Morris
Quoted 1 line

1..how to pipe two copy together

This is what I use after some experimenting. I've found it's often far faster than the more obvious use of dd:

nice -5 dd if=/dev/clones/from bs=64M iflag=direct |
dd of=/dev/scratch/to bs=64M oflag=direct

I use 64 MB extents. For smaller extents, a matching dd block size might be good.

Thanks for that recipe. It ought to be in lvm2 as an lvcopy utility (dynamically determining extent size, etc).

Quoted 5 lines
Quoted 5 lines

2.i take lv as xen-guestOS's disk. usually many guestOS created from one lv(called template), maybe many data is readonly, so if so many lvs share readonly part ,and have its private data? COW save disk space, and take less time. i do not think snapshot is sutable for this case. thanks

As long as the origin is not often modified, having many snapshots is efficient. Each write to the origin will of course entail a write to each snapshot. (And as I discovered recently, if write barriers are disabled or buggy at any hardware or software layer, a power failure during heavy writes to the origin is particularly vulnerable to write reordering corrupting a snapshot. So make sure UPS is working before updating the origin.)

--

	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154

"Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial.

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#6 lore raw
In reply to Zdenek Kabelac
Quoted 4 lines

Isn't this already done in a better way by 'dd' using 'zero' copy mechanism ?? (assuming it is already using either 'mmap()' -> 'write()' or 'splice()' as your proposed piped copy is doing a lot of pointless memory copies and cache trashing.

No, with directio there isn't "a lot of pointless memory copies and cache trashing". There are in fact fewer mempoy copies than there would be with a simple:
dd if=thing of=thing

See:
http://www.ukuug.org/events/linux2001/papers/html/AArcangeli-o_direct.html

The proof of the pudding is in the eating, and in fact that recipe is extremely fast, for this application (sequential copy of GBs from one device to another). I spent a couple of hours testing before spending hundreds of hours copying. My bottom line was speed, so I didn't even look at memory usage or CPU. I would't mind using an extra 64 MB in order to get my copying done 30 hours faster.

Signature · 16 lines
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Thu, 31 Mar 2011 14:15:04 +0200
Quoted 35 lines · Zdenek Kabelac

Dne 31.3.2011 02:27, Stuart D. Gathman napsal(a):

Quoted 7 lines · Ray Morris
Quoted 6 lines
Quoted 2 lines

1..how to pipe two copy together

This is what I use after some experimenting. I've found it's often far faster than the more obvious use of dd:

Quoted 9 lines
Quoted 5 lines

nice -5 dd if=/dev/clones/from bs=64M iflag=direct |
dd of=/dev/scratch/to bs=64M oflag=direct

I use 64 MB extents. For smaller extents, a matching dd block size might be good.

Thanks for that recipe. It ought to be in lvm2 as an lvcopy utility (dynamically determining extent size, etc).

Isn't this already done in a better way by 'dd' using 'zero' copy mechanism ?? (assuming it is already using either 'mmap()' -> 'write()' or 'splice()' as your proposed piped copy is doing a lot of pointless memory copies and cache trashing.

If it's still faster - then your kernel setting for buffering are most probaly not tuned for the best performance.

Zdenek

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#7 lore raw

Dne 5.4.2011 18:25, Ray Morris napsal(a):

Quoted 5 lines
Quoted 4 lines

Isn't this already done in a better way by 'dd' using 'zero' copy mechanism ?? (assuming it is already using either 'mmap()' -> 'write()' or 'splice()' as your proposed piped copy is doing a lot of pointless memory copies and cache trashing.

Quoted 8 lines

No, with directio there isn't "a lot of pointless memory copies and cache trashing". There are in fact fewer mempoy copies than there would be with a simple:
dd if=thing of=thing

See:
http://www.ukuug.org/events/linux2001/papers/html/AArcangeli-o_direct.html

Seem like 10 years old paper for 2.4.6 kernel - so I do not think it still applies to upstream 2.6.38 - thought I've not made any recent measuring myself.

Quoted 7 lines

The proof of the pudding is in the eating, and in fact that recipe is extremely fast, for this application (sequential copy of GBs from one device to another). I spent a couple of hours testing before spending hundreds of hours copying. My bottom line was speed, so I didn't even look at memory usage or CPU. I would't mind using an extra 64 MB in order to get my copying done 30 hours faster.

The kernel should be able to use as much free memory as you have - and when it's properly configured - disk flushing running in separate thread should ensure maximal throughput.

If you are experiencing significant performance degradation with usage of single 'dd' with two different driver compared with 2 piped 'dd' - you should probably make a report on lkml list - There is something broken if you gain 'hours' like you said by piping 2 dd commands.

(I don't have fast enough arrays myself for such playing)

Zdenek

#8 lore raw

[linux-lvm] Taking it off list - Re: copy lv from lv?

Quoted 5 lines

If you are experiencing significant performance degradation with usage of single 'dd' with two different driver compared with 2 piped 'dd' - you should probably make a report on lkml list - There is something broken if you gain 'hours' like you said by piping 2 dd commands.

I'm taking this off list as off topic, so if anyone else is interested please let me know and I'll update you on what we find.

Signature · 16 lines
Ray Morris
[email protected]

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php




On Tue, 05 Apr 2011 23:10:20 +0200
Quoted 47 lines · Zdenek Kabelac

Dne 5.4.2011 18:25, Ray Morris napsal(a):

Quoted 5 lines
Quoted 4 lines

Isn't this already done in a better way by 'dd' using 'zero' copy mechanism ?? (assuming it is already using either 'mmap()' -> 'write()' or 'splice()' as your proposed piped copy is doing a lot of pointless memory copies and cache trashing.

Quoted 8 lines

No, with directio there isn't "a lot of pointless memory copies and cache trashing". There are in fact fewer mempoy copies than there would be with a simple:
dd if=thing of=thing

See:
http://www.ukuug.org/events/linux2001/papers/html/AArcangeli-o_direct.html

Seem like 10 years old paper for 2.4.6 kernel - so I do not think it still applies to upstream 2.6.38 - thought I've not made any recent measuring myself.

Quoted 7 lines

The proof of the pudding is in the eating, and in fact that recipe is extremely fast, for this application (sequential copy of GBs from one device to another). I spent a couple of hours testing before spending hundreds of hours copying. My bottom line was speed, so I didn't even look at memory usage or CPU. I would't mind using an extra 64 MB in order to get my copying done 30 hours faster.

The kernel should be able to use as much free memory as you have - and when it's properly configured - disk flushing running in separate thread should ensure maximal throughput.

If you are experiencing significant performance degradation with usage of single 'dd' with two different driver compared with 2 piped 'dd' - you should probably make a report on lkml list - There is something broken if you gain 'hours' like you said by piping 2 dd commands.

(I don't have fast enough arrays myself for such playing)

Zdenek

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/