LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2015, 07:09 AM   #1
ixion22600
LQ Newbie
 
Registered: Nov 2013
Posts: 23

Rep: Reputation: Disabled
recover deleted file btrfs


Hi all,

How can one undelete a specific text file in btrfs?

os: opensuse 13.2
fs: /home filesystem
file: located in a directory in /home

please let me know if you have some examples available.

many thanks!
 
Old 06-15-2015, 07:58 PM   #2
wagscat123
Member
 
Registered: Jan 2009
Location: Maryland-Pennsylvania border, USA
Distribution: openSUSE 42.2, 42.3, Tumbleweed, OS X 10.10, Ubuntu 17.04, and Linux Mint 17.3/18.1
Posts: 660
Blog Entries: 9

Rep: Reputation: 89
If you have saved snapshots, you can use snapper to go back to a snapshot containing your lost files:
https://lizards.opensuse.org/2011/04...ucing-snapper/


Otherwise, you'll want to unount the partition, not write anything to it, and boot to a LiveCD and use a utility called "testdisk" (to prevent the file from being overwritten). You can get if from http://www.cgsecurity.org/ and through software.opensuse.org and possibly zypper. testdisk wasn't originally made for btrfs but it might be able to help you. The first few Google searches I skimmed through didn't have any better ideas.
 
1 members found this post helpful.
Old 06-16-2015, 05:34 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,045

Rep: Reputation: Disabled
I also read that "photorec" is very good at restoring files despite its somewhat misleading name. Never tried it myself and I believe it must be bought.
 
Old 06-16-2015, 10:38 AM   #4
cepheus11
Member
 
Registered: Nov 2010
Location: Germany
Distribution: Gentoo
Posts: 281

Rep: Reputation: 88
No, photorec is part of the "testdisk" package. Photorec is the tool to use here, not testdisk. Testdisk only restores partition tables.

A filesystem debugger would be a more surgical tool to recover one particular deleted file, instead of all and then searching through them. But I don't know if there is such a debugger for btrfs, and filesystem debuggers require a hell of learning to use.
 
2 members found this post helpful.
Old 06-17-2015, 01:00 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,045

Rep: Reputation: Disabled
Ah, thanks for the clarification.
 
Old 06-17-2015, 04:19 AM   #6
ixion22600
LQ Newbie
 
Registered: Nov 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thanks guys for the posts. I was very lucky because there was a vi swp file and I managed to recover part of the code that I worked on

But for beying productive, what do you guys use to keep a automatic backup of your code/scripts and so on, what would be the method that works for you the best?

Thanks!
 
Old 06-17-2015, 04:24 AM   #7
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,045

Rep: Reputation: Disabled
I use backintime which can be configured to all your needs I'd say (backintime on my home setup, work is automated by the IT-department every 3 hours). Btw. I thought vim can do versioning?
 
Old 06-17-2015, 05:24 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,872

Rep: Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190Reputation: 2190
You're using btrfs, take a snapshot. Takes no time, can be run anytime, and occupies (almost) no space.
Take a snap, back it up at your leisure while you are working.

For btrfs you'd better be conversant with the wiki - it has a page describing how to do your own incremental backups.

As to the original question, there are scripts on the net for recovering deleted (btrfs) files, but they are not foolproof. Use backups.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to Recover File deleted with ' rm -rf ' command. Rohant Linux - Newbie 4 08-19-2012 01:39 PM
[SOLVED] Help, I deleted a file. How do I recover it? coolgreen1 Linux - General 10 11-22-2010 03:39 PM
Trying to recover a deleted file. mckinnon81 Linux - Newbie 1 05-02-2010 10:56 PM
I have deleted a file thru rm can i recover it ricka343 Linux - General 2 06-27-2006 03:28 AM
How to recover deleted file v1nc3nt Linux - Newbie 5 05-23-2006 03:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration