[lxc-devel] [PATCH 1/1] lxc-clone: change uuid on xfs
Serge Hallyn
serge.hallyn at canonical.com
Thu Jul 12 21:37:50 UTC 2012
Otherwise after cloning an lvm+xfs container you can't run the
original and clone at the same time.
Based on a patch by Maurizio Sambati posted at
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1013549
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
src/lxc/lxc-clone.in | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in
index c7413f2..13cb712 100644
--- a/src/lxc/lxc-clone.in
+++ b/src/lxc/lxc-clone.in
@@ -199,7 +199,13 @@ if [ -b $oldroot ]; then
lxc-freeze -n $lxc_orig
frozen=1
fi
- lvcreate -s -L $lxc_size -n ${lxc_lv_prefix}${lxc_new}_snapshot $oldroot
+ newlv="${lxc_lv_prefix}${lxc_new}_snapshot"
+ lvcreate -s -L $lxc_size -n $newlv $oldroot
+ type xfs_admin > /dev/null 2>&1 && {
+ # change filesystem UUID if it is an xfs filesystem
+ xfs_admin -u /dev/$lxc_vg/$newlv && xfs_admin -U generate /dev/$lxc_vg/$newlv
+ }
+
if [ $container_running = "True" ]; then
lxc-unfreeze -n $lxc_orig
frozen=0
--
1.7.9.5
More information about the lxc-devel
mailing list