All of lore.kernel.org
 help / color / mirror / Atom feed
* Deleting subvolumes - there be dragons
@ 2014-01-29 11:41 KC
  2014-01-29 12:28 ` Hugo Mills
  2014-01-29 16:44 ` Chris Murphy
  0 siblings, 2 replies; 3+ messages in thread
From: KC @ 2014-01-29 11:41 UTC (permalink / raw)
  To: linux-btrfs

I just read this article here: https://lwn.net/Articles/579009/  which 
states:

---------------------------------
btrfs subvolume delete path

  For ordinary subvolumes (as opposed to snapshots, described below), 
the subvolume indicated by path must be empty before it can be deleted.
---------------------------------

So I gave it a try:

$ sudo btrfs subvolume create /home2
$ sudo mkdir /home2/lalala
< copy a random pdf file into /home2/lalala) >
$ sudo btrfs subvolume delete /home2

And boom! It's all gone!
Even though subvolume was not empty.

So apart from the fact that it looks like the article is wrong here, it 
seems very dangerous to me that one simple command can nuke an entire 
volume, even if it's full of files and folders.

Of course I'm new to btrfs so maybe I'm reading something wrong. If so, 
then please do set me straight.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Deleting subvolumes - there be dragons
  2014-01-29 11:41 Deleting subvolumes - there be dragons KC
@ 2014-01-29 12:28 ` Hugo Mills
  2014-01-29 16:44 ` Chris Murphy
  1 sibling, 0 replies; 3+ messages in thread
From: Hugo Mills @ 2014-01-29 12:28 UTC (permalink / raw)
  To: KC; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

On Wed, Jan 29, 2014 at 12:41:57PM +0100, KC wrote:
> I just read this article here: https://lwn.net/Articles/579009/
> which states:
> 
> ---------------------------------
> btrfs subvolume delete path
> 
>  For ordinary subvolumes (as opposed to snapshots, described below),
> the subvolume indicated by path must be empty before it can be
> deleted.
> ---------------------------------

   As you have found, that's not correct. In fact, there's a couple of
potentially misleading things in that article, just from skimming the
first few paragraphs...

> So I gave it a try:
> 
> $ sudo btrfs subvolume create /home2
> $ sudo mkdir /home2/lalala
> < copy a random pdf file into /home2/lalala) >
> $ sudo btrfs subvolume delete /home2
> 
> And boom! It's all gone!
> Even though subvolume was not empty.
> 
> So apart from the fact that it looks like the article is wrong here,
> it seems very dangerous to me that one simple command can nuke an
> entire volume, even if it's full of files and folders.

   You can do the same thing with rm -rf on any filesystem. So yes,
it's a dangerous command, and you need to be sure you want to run it.

> Of course I'm new to btrfs so maybe I'm reading something wrong. If
> so, then please do set me straight.

   No, I think the author of the article is just mistaken.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
    --- You can't expect a boy to be depraved until he's gone to ---     
                             a good school.                              

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Deleting subvolumes - there be dragons
  2014-01-29 11:41 Deleting subvolumes - there be dragons KC
  2014-01-29 12:28 ` Hugo Mills
@ 2014-01-29 16:44 ` Chris Murphy
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Murphy @ 2014-01-29 16:44 UTC (permalink / raw)
  To: KC; +Cc: linux-btrfs


On Jan 29, 2014, at 4:41 AM, KC <impactoria@googlemail.com> wrote:

> I just read this article here: https://lwn.net/Articles/579009/  which states:
> 
> ---------------------------------
> btrfs subvolume delete path
> 
> For ordinary subvolumes (as opposed to snapshots, described below), the subvolume indicated by path must be empty before it can be deleted.
> ---------------------------------

That's not correct, but maybe the author meant that a subvolume you intend to delete must not contain another subvolume. A subvolume in another subvolume will anchor the parent.


Chris Murphy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-29 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 11:41 Deleting subvolumes - there be dragons KC
2014-01-29 12:28 ` Hugo Mills
2014-01-29 16:44 ` Chris Murphy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.