[Lxc-users] lxc-destroy fs
Serge Hallyn
serge.hallyn at ubuntu.com
Thu Mar 7 22:05:24 UTC 2013
Quoting Papp Tamas (tompos at martos.bme.hu):
> On 03/07/2013 04:54 PM, Serge Hallyn wrote:
> >
> >Quoting Papp Tamas (tompos at martos.bme.hu):
> >>
> >>hi All,
> >>
> >>At the end of this script it wants to remove the fs in some cases.
> >>But something is wrong about it, as if it's other they are ignored.
> >
> >Sorry I don't understand - what is being ignored in which cases?
>
> I really should avoid my email client, when I'm tired...
> I wrote so many non-English mails in the last days. Sorry...:)
>
> >># Deduce the type of rootfs
> >># If LVM partition, destroy it. For btrfs, we delete the subvolue. If anything
> >># else, ignore it. We'll support deletion of others later.
>
> There is a statement, that if it's not LVM or btrfs, it won't be removed.
Oh, that's a misleading statement I guess :) But,
> >>rootdev=`grep lxc.rootfs $lxc_path/$lxc_name/config 2>/dev/null | sed -e 's/^[^/]*/\//'`
> >>if [ -n "$rootdev" ]; then
> >> if [ -b "$rootdev" -o -h "$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
> >> if which btrfs >/dev/null 2>&1 &&
> >> btrfs subvolume list "$rootdev" >/dev/null 2>&1; then
> >> btrfs subvolume delete "$rootdev"
> >> else
> >> # In case rootfs is not under $lxc_path/$lxc_name, remove it
> >> rm -rf --one-file-system --preserve-root $rootdev
>
> But it's removed here.
>
> >> fi
> >> fi
> >>fi
> >>
> >># recursively remove the container to remove old container configuration
> >>rm -rf --one-file-system --preserve-root $lxc_path/$lxc_name
>
> And of ourse here.
>
>
> Do I miss something?
Yes - if the fs is some other blockdev or a loopback file, that won't be
deleted. I think that's what that meant.
-serge
More information about the lxc-users
mailing list