diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in index aa9473bec..5ae572213 100644 --- a/src/lxc/lxc-destroy.in +++ b/src/lxc/lxc-destroy.in @@ -110,13 +110,16 @@ fi # If LVM partition, destroy it. If anything else, ignore it. We'll support # deletion of others later. rootdev=`grep lxc.rootfs $lxc_path/$lxc_name/config 2>/dev/null | sed -e 's/^[^/]*/\//'` -if [ ! -z "$rootdev" ]; then - if [ -b "$rootdev" -o -h "$rootdev" ]; then +if [ -n "$rootdev" ]; then + if [ -b "$rootdev" ]; then lvdisplay $rootdev > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "removing backing store: $rootdev" lvremove -f $rootdev fi + elif [ -h "$rootdev" -o -d "$rootdev" ]; then + # In case rootfs is not under $lxc_path/$lxc_name, remove it + rm -rf --one-file-system --preserve-root $rootdev fi fi # recursively remove the container to remove old container configuration