Re: BTRFS partition corrupted after deleting files in /home

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 7, 2021 at 1:40 AM Sreyan Chakravarty <sreyan32@xxxxxxxxx> wrote:
>
> Can you tell me how you are planning to use the metadata image ?
>
> Are you going to mount it with losetup and then run btrfs-check on it ?
>
> I am asking because I can perform the checks from my side.

Sorry I missed you on IRC.

The Btrfs dev has been doing this with a devel branch, it's not in the
released version of btrfs-progs yet. And it needed further enhancement
for this case, because a whole bunch of writes in a commit just didn't
get to stable media. This fsck enhancement is still being tested, but
should be ready soon, and when it is I'll get it built in copr.

In the meantime, about your btrfs restore command:

# btrfs restore -sxmS -D /dev/mapper/dm_crypt
/run/media/liveuser/Backup\ Plus/restore/

Try adding -i and remove -D. The -D means files aren't restored. And
-m and -x require files to be restored first or you get additional
errors.

However, note that the -s option restores the contents of all
snapshots, and puts them into directories as independent (not deduped)
files in the restore destination. So if you have a file in 50
snapshots, that file gets replicated 50 times. So while you get all
your files out of the snapshots, it's not really putting Humpty Dumpty
back together again in terms of the original organization.

You might prefer just getting all the files out of a particular
snapshot. That's the -r option. But *sigh* it only takes subvolids.
Since you can't mount, you can't use 'btrfs sub list' to get a listing
of names to ids. There is another way to do it:

sudo btrfs inspect-internal dump-tree -t 1 /dev/sdXY | grep -A1 'ROOT_REF'

That'll produce something like this, maybe many lines if you have many
snapshots.

    item 4 key (FS_TREE ROOT_REF 268) itemoff 14921 itemsize 28
        root ref key dirid 256 sequence 5 name home
    item 5 key (FS_TREE ROOT_REF 525) itemoff 14899 itemsize 22
        root ref key dirid 256 sequence 33 name root

Above, the first item is the subvolume "home" and its ID is 268. The
second is the subvolume "root" and its ID is 525. Snapshots appear in
this same list with the same scheme. If I want to pull out just the
files in "home" I do this:

# btrfs restore -v -i -r 268 /dev/sdXY /path/to/restore/to

You could add -x -m to this if you want.

There is more here, in case I'm not around again, but hopefully we'll
figure out an overlap time on IRC.
https://btrfs.wiki.kernel.org/index.php/Restore



-- 
Chris Murphy
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux