]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-clone: use hardlink detection in rsync
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 3 Dec 2012 15:47:37 +0000 (09:47 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 4 Dec 2012 16:10:00 +0000 (10:10 -0600)
Otherwise busybox clones have been reported to explode from
2M to 440M.

Reported-by: Rene K. Mueller <spiritdude@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
src/lxc/lxc-clone.in

index 04ef20bb2465055e50892d26a7afe5e3a449acc5..7c649a6c71f437041d5cf9f6afc3809a9b5456a9 100644 (file)
@@ -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