8

I'm new to btrfs and I am trying to delete some snapshots I made a few months ago. They're taking up about 20GB of space, and I need that space back.

This seems to list the snapshots:

↪ sudo btrfs subvolume list /
ID 257 gen 82021 top level 5 path @
ID 258 gen 82021 top level 5 path @home
ID 263 gen 81983 top level 5 path @home/.ecryptfs/mlissner/.Private/ECRYPTFS_FNEK_ENCRYPTED.FWa8iOdaTukmNEROkGj4b5OZHZ0bKOqrvAQxu4dgX.2jUELJL22wpV94oU--/ECRYPTFS_FNEK_ENCRYPTED.FWa8iOdaTukmNEROkGj4b5OZHZ0bKOqrvAQxHunTlBS-30iHyukjeY9-EE--/root_post_install_2014-04-29
ID 364 gen 81986 top level 5 path @home/.ecryptfs/mlissner/.Private/ECRYPTFS_FNEK_ENCRYPTED.FWa8iOdaTukmNEROkGj4b5OZHZ0bKOqrvAQxu4dgX.2jUELJL22wpV94oU--/ECRYPTFS_FNEK_ENCRYPTED.FWa8iOdaTukmNEROkGj4b5OZHZ0bKOqrvAQxHunTlBS-30iHyukjeY9-EE--/root_post_install_2014-05-04
ID 376 gen 81996 top level 5 path @home/.ecryptfs/mlissner/.Private/ECRYPTFS_FNEK_ENCRYPTED.FWa8iOdaTukmNEROkGj4b5OZHZ0bKOqrvAQxu4dgX.2jUELJL22wpV94oU--/ECRYPTFS_FNEK_ENCRYPTED.FWa8iOdaTukmNEROkGj4b5OZHZ0bKOqrvAQxHunTlBS-30iHyukjeY9-EE--/root_post_install_2014-05-14

How do I delete them? When I try the obvious thing, I get an error:

↪ sudo btrfs subvolume delete root_post_install_2014-04-29
Delete subvolume '/home/mlissner/.btrfs/snapshots/root_post_install_2014-04-29'
ERROR: cannot delete '/home/mlissner/.btrfs/snapshots/root_post_install_2014-04-29' - Device or resource busy

I'm feeling a bit lost and Googling is revealing no real help. I'm happy to post more information if that will help, but for now, I'm a baffled how to proceed.

9
+25

From the output, I am guessing that the subvolume of which you have snapshots is actually an ecryptfs private directory. If that is correct, can you try unmounting the private directory and then try to delete the snapshots?

The error message states that the device is in use. Assuming you are not using that directory as a current working directory, and no other process is actively using the data in the snapshot, that leaves the encryption layer to worry about.

EDIT: my original assumption was that you only had a Private folder encrypted. From your comments, I guess that your whole home is encrypted. So if we want to manipulate that, we need your home to be inactive. For a convenient way to deal with this, you can try the following:

A. Add another user to the system giving that other user administrative rights (i.e. the right to use sudo). Instructions for how to do this in Ubuntu: add a user, then give the user administrative rights

B. Log on with the newly created user. Now try to list and destroy the snapshots. Make sure the original user is not logged in, as that will trigger the decryption (and thus, the use) of you home directory.

C. Remove the user created in the first step, unless you see a need to keep it around.

Oh, and, please make sure you have a back-up of the file systems you manipulate. A mistake is quickly made.

  • That makes sense. I didn't do anything explicit to mount the encrypted directory though. Do you know how to unmount it? – mlissner Aug 7 '14 at 12:52
  • Try using ecryptfs-umount-private. – Vincent De Baere Aug 7 '14 at 14:35
  • OK, I tried doing ecryptfs-umount-private --help, and rather than give me help docs, it swiftly umounted my home directory, a terrifying thing that was quickly crashing everything. I managed to get it remounted, but this feels very wrong, since I didn't have to do anything like this to make the snapshots. I'd love an explanation of why this is necessary now since it wasn't then as well as how to do this without my whole system starting to fall apart. – mlissner Aug 7 '14 at 18:23
  • The output of btrfs subvolume list shows a path including a hidden directory (.ecryptfs). That directory contains data which is encrypted. My guess is that you somehow choose to encrypt your home directory during installation of the OS. I'm editing my answer with a possible way around this. – Vincent De Baere Aug 8 '14 at 13:02
  • Unfortunately, the above process doesn't work. When the user isn't logged in, the path to the directory doesn't seem to exist. Looks like encryption + btrfs is super hard to use. – mlissner Aug 19 '14 at 18:34
0

I wasn't able to get this question answered in a way that worked, but I posted a new question over on askubuntu once I understood the problem better. I was eventually able to get a solution there:

https://askubuntu.com/questions/513534/cannot-delete-encrypted-btrfs-snapshot/513547#513547

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.