All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörg Walter" <info@syntax-k.de>
To: linux-btrfs@vger.kernel.org
Subject: btrfs-undelete shell-script
Date: Thu, 24 Jan 2013 16:56:06 +0100	[thread overview]
Message-ID: <1842933.L15n886rVc@queen> (raw)

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]

Hi,

I tried to recover an accidentally deleted text file from a btrfs volume using 
the trusty old 'grep --text -C 500' method and failed, since the filesystem was 
compressed. So I wrote a shell script that uses btrfs-progs for a proper 
undelete functionality.

Attached is the script that implements a working btrfs-undelete using the find-
root and restore tools from btrfs-progs. It is fairly complete and solid and 
it even has some command  line help. It needs bash and common unix utilities 
(sed, grep, wc, dirname, sort). I have successfully used it to recover a 
couple of files I deleted accidentally and was able to recover 2/3 of them just 
fine. The rest was zero-sized, I assume that's because the file blocks have 
already been reused.

If you like it, feel free to add it to btrfs-progs. I've chosen GPLv2 or later 
as license, as that's what btrfs-progs seems to use.

Please CC me on replies, I am not subscribed (and don't intend to).

-- 
Mit freundlichen Grüßen,

	Jörg Walter

[-- Attachment #2: btrfs-undelete --]
[-- Type: application/x-shellscript, Size: 2862 bytes --]

             reply	other threads:[~2013-01-24 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 15:56 Jörg Walter [this message]
2015-10-28  6:06 ` btrfs-undelete shell-script JDAIII

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1842933.L15n886rVc@queen \
    --to=info@syntax-k.de \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.