Today for some reason my laptop start in read only mode, when I try to restore a btfrs partition, it try to start but only a yellow screen appear and when I re try to run the last snapshot then emergency mode start

I’m a newbie in the Linux environment, I been reading forums and suggestions this is my /etc/fstab output

This is my blkid output

This is part of my journalctl -xb
BTFRS error: (device dm-0): unable to find ref byte nr 144273260544 parent 906575872 root 492 owner 0 offset 0

I have an important virtual machine that a I can’t recover , i try copy files from live usb but it give me error in files bigger than 10 gb.

Con someone guide me or help me please

Regards

Sorry I can’t post images, but if some data is necessary I can post here

Boot from a live system and do btrfs check /dev/YOURSYSTEMROOTPARTITION on the unmounted partition. You will get error messages which will help you to look at further steps.
Afterwards, try to mount the partition and look for error messages here too:
sudo dmesg | grep "BTRFS"

sudo journalctl  -p3  

I have recently fixed my btrfs partiton after several system hangs which prbb. caused the failure. Your error message was different from mine. Do you get more error messages?

You can also reboot the live system and make an image of your inaccessible drive, then copy the data from it.

If your drive is encrypted:

sudo cryptsetup luksOpen /dev/YOURSYSTEMROOTPARTITION    systemroot

sudo dd if=/dev/mapper/systemroot of=/your/path/to/another/storage/device/btrfsimage bs=1M

When done, mount the image to rescue/save/back up the data, for instance your >10gb files:
sudo mount -o ro,rescue=nologreplay /your/path/to/another/storage/device/btrfsimage /run/media/manjaro/btrfsimagemounted

1 Like

Hello, thanks for answering, as I’m telling you, I’m new to this environment, you know that it detects them as in the /dev folder, otherwise in /run/media when I try to check them from USB LIVE and yes my drive is encrypted

try to check them

This is you mounting the partition (to /run/media). Once you see the content, it’s mounted.
Reboot and don’t mount (i. e. don’t click on the drive in e.g. Dolphin). Work in terminal. You need to luksOpen the partition (that’s just decryting and not mounting).

sudo cryptsetup luksOpen /dev/YOURSYSTEMROOTPARTITION    systemroot

then you can sudo btrfs check /dev/mapper/systemroot
or make the image like described above.


Mounted, means like you described, you see the files in /run/media/… afterwards, is when you click on the in Dolphin or other file managers too.
Then you get error messages in sudo dmesg | grep "BTRFS"

or

sudo journalctl  -p3  
1 Like

thanks for your guide, I was analyzing the partitions with gpart, once it finish I start with those commands

Good idea to check and/or backup as soon as possible …
Because the title description could indicate a failing drive.

Yes! Do these steps first:

Reboot your live environment

And see to get all (or all you need) from btrfsimagemounted

1 Like

this is the output:
sudo cryptsetup luksOpen /dev/nvme0n1p2 systemroot
sudo btrfs check /dev/mapper/systemroot

Opening filesystem to check...
Checking filesystem on /dev/mapper/systemroot
UUID: 26104594-05bf-4666-9597-41ce148cfe64
[1/7] checking root items
[2/7] checking extents
tree extent[144273260544, 16384] parent 8796999598080 has no tree block found
tree extent[144273260544, 16384] parent 906575872 has no backref item in extent tree
incorrect global backref count on 144273260544 found 6 wanted 5
backpointer mismatch on [144273260544 16384]
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups
ERROR: bytenr ref not found for parent 8796999598080
ERROR: not enough memory: accounting for refs for qgroups
ERROR: failed to check quota groups
found 713982095360 bytes used, error(s) found
total csum bytes: 677695472
total tree bytes: 2638954496
total fs tree bytes: 1693843456
total extent tree bytes: 135331840
btree space waste bytes: 437251418
file data blocks allocated: 1451661459456
 referenced 722020425728

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

Gpart does not seem to support btrfs, so better don’t use it.

Ok, before we do anything with the broken drive or filesystem itself, we’ll try to make an image of it. Do you have another drive at hand? Then make the image.

1 Like

ok thanks, i stop gpart when i see your first suggestion.

yes i have another ssd m2 installed on my lap, is empty/clean not encrypted

Is there a filesystem on it?

yes, btfrs the same space of the damaged one

Make the image file then and save it on it to save your data. You need more storage space afterwards for the rescued files. Got any?

yes in another ssd to USB,

sudo dd if=/dev/mapper/systemroot of=/your/path/to/another/storage/device/btrfsimage bs=1M

When done, mount the image to rescue/save/back up the data, for instance your >10gb files:
sudo mount -o ro,rescue=nologreplay /your/path/to/another/storage/device/btrfsimage /run/media/manjaro/btrfsimagemounted

this commands will help for the image creation and backup?

The image is a big file where all the individual files of the partition are in.
The first command makes the image.
The second one mounts it with some safety mount options ( ro,rescue=nologreplay).
Once mounted you are hopefully able to see the files.
Then you can copy them to your USB drive.

1 Like

ok thanks, im making the image right now… i think will take some time

I do:

sudo dd if=/dev/mapper/systemroot of=/dev/nvme1n1 bs=1M                                                                                                                      
906090+1 records in
906090+1 records out

then

sudo mount -o ro,rescue=nologreplay /dev/nvme1n1 /run/media/manjaro/backo    

the backo is the label of the nvme1n1 (the other clean installed ssd) but give me:

 mount: /run/media/manjaro/backo: mount(2) system call failed: File exists.
dmesg(1) may have more information after failed mount system call.