Announcement

Collapse
No announcement yet.

Cannot delete subvolume

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cannot delete subvolume

    I recently had to do a rollback using Greygeek's easy-to-follow instructions. I had to mv my @ to @old in order to rollback both @ and @home from my snapshots folder. The rollback went fine, so I deleted the @homeold folder successfully, but got the following error when I tried to delete @old:

    root@steve-B460MDS3HV2:/mnt# btrfs subv delete /mnt/@old
    Delete subvolume (no-commit): '/mnt/@old'
    ERROR: Could not destroy subvolume/snapshot: Directory not empty

    What did I do wrong? How do I get rid of it?



    #2
    This happens if there's a snapshot inside a snapshot. You have to delete the nested snapshot first.

    This command should list all snapshots. Assuming "/mnt/ is the location you have the root btrfs file system mounted:

    sudo btrfs su li /mnt

    I again assume you will see something like:

    ID 2569 gen 1940946 top level 5 path @old
    ID 3236 gen 2865617 top level 2569 path @old/@some_subvol

    Note the ID of @old is listed as the "top level" of the second entry.

    Deleting @some_subvol will then allow the deletion of @old

    Please Read Me

    Comment


      #3
      Here's what I get when I use the li command:

      root@steve-B460MDS3HV2:~# btrfs su li /mnt/@old
      ID 256 gen 48999 top level 5 path @old
      ID 457 gen 578 top level 256 path var/lib/portables
      ID 458 gen 579 top level 256 path var/lib/machines
      ID 542 gen 49282 top level 5 path @
      ID 543 gen 49282 top level 5 path @home
      ID 545 gen 49015 top level 5 path snapshots/@_211211-123921_ro
      ID 546 gen 49017 top level 5 path snapshots/@home_211211-124017_ro


      The last two are today's snapshots. I remember seeing something like the two entries just below ID 256, and I presume these are the two subvolumes causing the trouble. Do I delete them to get rid of @old? I'm not doing anything until I find out.

      Comment


        #4
        It looks like :

        ID 457 gen 578 top level 256 path var/lib/portables
        ID 458 gen 579 top level 256 path var/lib/machines

        are indeed the problem. I would just verify they don't contain anything (I have them here but they are empty) and if so, delete them:

        sudo btrfs su de -c /mnt/@old/var/lib/portables
        sudo btrfs su de -c /mnt/@old/var/lib/machines
        sudo btrfs su de -c /mnt/@old/

        If they are NOT empty, one would probably want to review the contents.

        Frankly, I find it exceedingly strange these folders are subvolumes. Something went haywire with some btrfs program or script you ran in the past I suppose.

        Please Read Me

        Comment


          #5
          Thanks, that certainly did the trick. By the way, was the -c necessary in the commands?

          Comment


            #6
            Not necessary, but "commit" gets it done asap. Since btrfs actions are cached, if you were to continue using your file system after issuing the nested delete commands, I felt it might take a while to complete. If something were to crash the system prior to the completion of the delete, the subvolume might reappear. I just feel it best to get the deletions over with asap to avoid potential problems.

            Please Read Me

            Comment


              #7
              Thanks for the information and the help. Sometimes I get frustrated with btrfs, but usually it's my fault, most often typing errors!

              Comment


                #8
                no problem, that's why I lurk here, lol. I've been using BTRFS daily since btrfs-tools version 0.19! Now we're on like 5.4 or something

                Please Read Me

                Comment

                Working...
                X