D
D
Dmitry2020-04-22 15:56:47
linux
Dmitry, 2020-04-22 15:56:47

How to recover data in btrfs in ubuntu 18.04?

Good afternoon.
There is a partition with the btrfs file system. Accidentally deleted the contents of one directory from this section. Of all the contents, only one file is of interest.
I tried to use testdisk, but the utility does not work with btrfs. The only thing that happened was to create a partition image in this utility.
I also searched the internet.
I found information that you can use btrfs restore. But I did not fully understand whether it is possible to restore a separate file using this tool.
I tried to do it myself, but it didn't work.
1) Booted from a flash drive.
2) Mounted in / media the disk to which you want to write the restored file.
3) I got the block number through btrfs-find-root.
4) Executed the commandbtrfs restore -t 65626112 /dev/sdb1 /media/usb
All directories of the partition were copied to /media/usb, but I did not find the necessary file.

In general, in order not to break everything, I finally decided to ask a question here.
How to recover a deleted file?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shitskov, 2020-04-22
@Zarom

If the file does not exist, then most likely it really does not exist. You can try your luck with wrapper script
https://gist.github.com/Changaco/45f8d171027ea2655d74

M
mayton2019, 2020-04-23
@mayton2019

Have a look at the utilities
- binwalk
- first
- photorec
They are file system tolerant and they recover known file formats from signatures. And if your desired file was JPG/png/avi or the like, then there is a chance that it will be saved. But these utilities are without guarantees and at your own peril and risk.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question