2

I have a snapshot that I'd like to delete:

04:03:21::mlissner@pounamu::~ 
↪ sudo btrfs subvolume list /
ID 257 gen 267078 top level 5 path @badroot
ID 258 gen 267151 top level 5 path @home
ID 422 gen 267151 top level 5 path @

The one called @badroot is bad and must go. But:

04:03:23::mlissner@pounamu::~ 
↪ sudo btrfs subvolume delete \@badroot
ERROR: error accessing '@badroot'
04:03:31::mlissner@pounamu::~ 

So I don't know where to proceed. I tried reading the help file:

↪ sudo btrfs subvolume delete --help
usage: btrfs subvolume delete <subvolume> [<subvolume>...]

    Delete subvolume(s)

But that's useless too. Perhaps the kind people of the Internet have ideas.

migrated from serverfault.com Mar 8 '15 at 10:47

This question came from our site for system and network administrators.

10

First possibility

It seems like you are referring to @badroot using the wrong path.

If I am reading your shell prompt correctly, your current directory is ~, your home directory — which is probably /home/mlissner or similar. You are specifying the path to the subvolume as a relative path (does not start with /), so you are effectively asking to delete something like /home/mlissner/@badroot... which does not exist.

Try an absolute path instead:

sudo btrfs subvolume delete /@badroot

Second possibility

Perhaps you have a non-default subvolume mounted on /, for example number 422, @. In this case, only that subvolume appears under / and you cannot see anything above that path, including the other two subvolumes plus any regular files located in the root of the Btrfs.

In this case, mount the true Btrfs root somewhere else so that you can access its contents. The Btrfs's true root is known as subvolume ID 0 (and is not listed by btrfs subvolume list). Find or create a free mount point and mount as follows:

mount -o subvolid=0 /dev/some-device /mnt

Now you should be able to see /mnt/@, /mnt/@badroot, /mnt/@home, plus maybe some other files under /mnt. You can delete subvolume /mnt/@badroot as usual.

  • Hm, yeah, that was my thinking too, but I couldn't find @badroot. Any easy way to find these subvolumes? – mlissner Mar 8 '15 at 17:06
  • Ah, so that was wrong. I added another possibility to my answer. – Celada Mar 9 '15 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.