On 2014-11-29 23:23, Marc MERLIN wrote:
Well, in theory, if you unmount the FS _immediately_ after the subvol delete, without writing _anything_ else to it, it _might_ be possible to recover the data using some (probably almost incomprehensible) incantation of btrfs-find-root and btrfs recover/restore.On Sun, Nov 30, 2014 at 09:03:14AM +0530, Shriramana Sharma wrote:IIUC with BtrFS while it is possible to easily undelete a file or ordinary directory if a snapshot of the containing subvol exists, it seems that it's not elementary to undelete a subvol itself, because all subvols are under the root-level subvol (id 0 or 5, see my other q) but even snapshotting the root subvol will not snapshot any subvols under it.So is there any way to undo a subvol delete?If you didn't snapshot that volume before deleting it, you're SOL. If you snapshotted it, rename that snapshot to the other name, and you're done. Btrfs doesn't offer undelete, it only lets you keep multiple copies of your data at very little cost, so you can retrieve a snapshot copy if you deleted your current volume's data. Marc
In practice though, for anyone who doesn't have expert level knowledge of the on-disk structure and fs internals, deleting a subvolume can't be undone.
We might want to consider adding an option to btrfs subvol del to ask for confirmation (or make it do so by default and add an option to disable asking for confirmation).
smime.p7s
Description: S/MIME Cryptographic Signature