[lxc-devel] [PATCH 1/2] lxc-clone: use hardlink detection in rsync
Serge Hallyn
serge.hallyn at canonical.com
Mon Dec 3 16:00:56 UTC 2012
Otherwise busybox clones have been reported to explode from 2M to 440M.
Despite man pages claims to the contrary this does not seem to slow down
a lxc-clone or increase CPU use.
Reported-by: Rene K. Mueller <spiritdude at gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
src/lxc/lxc-clone.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in
index 04ef20b..7c649a6 100644
--- a/src/lxc/lxc-clone.in
+++ b/src/lxc/lxc-clone.in
@@ -225,7 +225,7 @@ if [ -b $oldroot ]; then
mkfs -t $fstype /dev/$lxc_vg/${lxc_lv_prefix}$lxc_new
mount /dev/$lxc_vg/${lxc_lv_prefix}$lxc_new $rootfs || { echo "$(basename $0): failed to mount new rootfs" >&2; false; }
mounted=1
- rsync -ax ${rootfs}_snapshot/ ${rootfs}/ || { echo "$(basename $0): copying data to new lv failed" >&2; false; }
+ rsync -Hax ${rootfs}_snapshot/ ${rootfs}/ || { echo "$(basename $0): copying data to new lv failed" >&2; false; }
umount ${rootfs}_snapshot
rmdir ${rootfs}_snapshot
lvremove -f $lxc_vg/${lxc_lv_prefix}${lxc_new}_snapshot
@@ -252,7 +252,7 @@ else
frozen=1
fi
mkdir -p $rootfs/
- rsync -ax $oldroot/ $rootfs/
+ rsync -Hax $oldroot/ $rootfs/
echo "lxc.rootfs = $rootfs" >> $lxc_path/$lxc_new/config
if [ $container_running = "True" ]; then
lxc-unfreeze -n $lxc_orig
--
1.7.9.5
More information about the lxc-devel
mailing list