On Mon, Dec 01, 2014 at 08:12:02AM -0500, Austin S Hemmelgarn wrote: > On 2014-11-29 23:23, Marc MERLIN wrote: > > 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 > > > 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. > > 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.
Agreed, though there's not so much magic involved. Deleting a subvolume means removing the directory entry and the backrefrence. Undoing that can make the subvolume live again, although the dir/name and original parent tree cannot be reconstructed. I'll add it to the project ideas. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html