GithubHelp home page GithubHelp logo

danthem / undelete-btrfs Goto Github PK

View Code? Open in Web Editor NEW
152.0 152.0 12.0 64 KB

A script that attempts to undelete files in a BTRFS file system. Make sure you read the README.

License: GNU General Public License v3.0

Shell 100.00%

undelete-btrfs's People

Contributors

danthem avatar virusdave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

undelete-btrfs's Issues

Thanks very much

Only to say an huge thanks for doing that script saving files from users.
You deserve much bless in your path.
Have an nice week.

btrfs-restore sometimes waits for user input

I noticed while trying to restore some huge files with lots of extents that btrfs restore would sometimes wait for user input if it looped too many times while searching the filesystem tree (or whatever it does). By sending all of btrfs restores output to /dev/null, this feedback is lost and the script apparently hangs—I had to terminate a run because the CPU usage of btrfs restore had sat at 0 for about half an hour.

Doesn't Generate the Regex?

Hey @danthem , regardless of what i enter for path or directory it just returns: Regex generated: '^/(|$'

This doesn't seem right?

I have tried another script and it did recover the file, but my issue is that I overwrote the file in question, so would it be possible with your script working to recover an older revision of the same file?

feature: check if <recovery destination> exists before attempting recovery

Would be lovely to have the script verify whether the <recovery destination> exists.

This could happen either:

  • before the file search commences, or
  • before the recovery attempt commences

If <recovery destination> does not exist:

  • offer an error message prior to attempting data recovery, or
  • offer to create <recovery destination>

Currently, if <recovery destination> doesn't exist, the user only discovers the problem and requirement once the recovery process has been engaged, and throws find errors:

image

Files not restored

Just recently, I had an incident where I deleted import files. I use BTRFS, so first thing I did was boot a live USB. The files appeared in BTRFS undelete (and I gave it the OK to restore), but when I mounted the drive to look for the files, they were nowhere to be found. Now BTRFS undelete can not even find them anymore to restore. My files are probably gone for good now, but I am curious why it did not save the files, I checked the live usb’s file system and the drive that the files were being restored from.

Smarter /tmp storage

By default this script stores some temporary data in /tmp , this is not always ideal and should be changed or at least customizable. I'm thinking about storing the files in $dst instead but need to make sure to ignore them when script checks if any data found.

A bonus feature would be to keep the temporary files and if they're detected, query user if they want to use the same roots or re-generate, but this also requires some kind of tracking of depth level.

(this issue was inspired by @d0m1n1qu3 who made a fork due to /tmp running out of space)

Could not find any files

I'm using a flat btrfs layout, that is the top volume is at /dev/nvme0n1p1 and several subvolumes inside mounted to different directories, e.g:

Subvol Label Mountpoint
@ /
@home /home

I booted into a live CD and run the script by sudo ./undelete-btrfs /dev/nvme0n1p1 /tmp, attempted to specify the file path as /etc/fstab and /@/etc/fstab respectively, but neither of them found the missing file.

Thanks!

I don't see a way to contact you on here, but just wanted to say thanks for saving my bacon 🥓.

The script got me out of a major hole at 1am last night!

You should consider adding a donate button...

No data found on LUKS encrypted drive

No matter what I enter as the input, the program is not able to find anything. The unlocked partition (whole disk) is at /dev/mapper/luks_drive . Is this a normal limitation?

Need review / testing with newer versions of btrfs-progs

I wrote this back when 4.15 was the latest version of btrfs-progs, btrfs-progs 5.2 is the latest version at the time of writing this.

Need to test and ensure script still works well and explore if there are any new features that can improve chances of recovery.

No data, of any kind, found

I'm trying to recover the directories I deleted by mistake with the rm command in the /home/user/.config directory.
When I launch the script from a bootable drive of Fedora, it can't find any data from any directory, not even the fstab file.
I've already check for right parsing of the device (which is /dev/sdb4).
Thanks.

Is this possible?: Convert /dev/sdd[1-5] Ext4 => /dev/sdd [btrfs - whole disk] - without losing data in sdd5 (old /home)

I have been using Fedora since Core 1 and still have the old HDs and I have kept using ext[234] FSs just for simplicity / consistency up to the current time (F39) - but now I want to experiment with btrfs and I was thinking I could go through the exercise of converting an old SATA boot drive where I am still using /dev/sdd5 (the old /home partition) as one of a few backup partitions / drives for current live data from my workstation and some small servers.

At first I was thinking I could delete ext4 parts 1-4, replace them with a new btrfs partition and then maybe somehow use btrfs-convert to integrate the remaining ext4 part 5 into the new part 1? . . but what I really want to do is create a new btrfs using the whole of the disk (GPT) - but somehow avoid having to spend a LONG time copying back about 4TB (to the 8TB drive) - the only way I could see that possibility working is to somehow do a recovery on the rest of the disk after the newly-created btrfs only takes up part of the beginning of the disk but leaves the old ext4 dirs and files recoverable somehow from near the beginning of the disk to just past halfway on the disk . .

This is just an interesting idea for experimenting with - it is not the end of the world if it is not possible or if it might be possible but difficult and I crash the drive in the experiment . . but I thought this script might offer a solution?

Detect if <dev> is mounted or not

Implement quick check to see if is mounted or not. Script can only run on umounted devices so pointless to try on one that's mounted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.