You are not logged in.

#1 2020-12-19 00:26:37

atohmdiy
Member
Registered: 2020-12-18
Posts: 3

Recover data from btrfs partition

Hello,
I made a huge mistake today. I wanted to copy my data to a new drive (ssd) i receive today. I create the btrfs partition with compress=zstd and few other option (defaults,noatime,space_cache,autodefrag,compress=zstd 0 2) Copy goes well, but  i stupidly remove the data from both drive with the delete command from kde dolphin. So first thing i do was to remove the new drive from fstab and unmount it, since then i try to recover my data without success. From my limited knowledge btrfs do not erase the data until new one overwrite the previous, so i hope i still have a chance. I spend some time trying to recover with the btrfs restore command.
Long story short, i didn't delete all the content in my new ssd drive, only two folder i need again Images and "Documents" (and there is important things in this folder). The folder i didn't delete is "Divers".

When i run this command :
yes a | sudo btrfs restore /dev/nvme1n1p1 /hd1/B2 -v -i

It recover only the "Divers" folder.

So then i try the btrfs root command and got this list of root :

4335910912
12582912
8798208
5439488
5292032
5259264

I try a simulation with -D in restore. With the 4335910912 it seems to recover the "Divers" folder.

I try the restore command for the others root like this :

yes a | sudo btrfs restore /dev/nvme1n1p1 /hd1/B2 -v -i -t 8798208

And it recreate the folder structure of my missing data, i got all the folder of my "Images" and "Documents" folders but no data in it. Maybe it's related to the compress data with zstd ?

I am a little desperate right now, i tried a btrfs-undelete script and it manage to recover a very few things from my "Documents" folder, but the files are few and they are empty.

Some advice would be greatly appreciated.

Thank you !

Last edited by atohmdiy (2020-12-19 00:30:34)

Offline

#2 2020-12-19 00:34:40

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Recover data from btrfs partition

Easy, just restore the missing data from your last backup.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2020-12-19 00:38:47

atohmdiy
Member
Registered: 2020-12-18
Posts: 3

Re: Recover data from btrfs partition

Slithery wrote:

Easy, just restore the missing data from your last backup.

Yah i have no backup sad

Offline

#4 2020-12-19 05:28:58

twobooks
Member
From: rainforest
Registered: 2020-06-23
Posts: 47

Re: Recover data from btrfs partition

I have no experience with btrfs, but want to give you a suggest.
buy a same model and same size drive.
use dd to copy the whole disk to your new bought drive.
work on your copy, don't tough the original disk.

Offline

#5 2020-12-19 12:04:32

atohmdiy
Member
Registered: 2020-12-18
Posts: 3

Re: Recover data from btrfs partition

Yes but unfortunately i can't, my new drive is 1.8 to, the last one is 4.5 to (hdd), and there is much things left on it.

The restore command did not work, i don't understand why it recover only the folders and not the data, maybe it has something to do with the compression.

Also once i made the mistake i try the restore command to recover from both the ancient and the new drive, result was the same it recover nothing or empty files. Yesterday i try several times to recover from the new one to the previous (hdd), it only recover the "Divers" folder that is big (790 go) so i think i erase the data on the previous hdd. I can only recover from my new ssd drive now that i left untouched and unmount since my mistake.

I really need a solution on this, my documents folder is important...

Offline

Board footer

Powered by FluxBB