The hard drive used by RAID was recognized by the USB external box, but the NAS cannot mount it.

Asked 2 years ago, Updated 2 years ago, 59 views

This is a continuation of where you want to recover data from a hard drive used by your NAS.

In Yotta's external HDD case, I put a 6TB hard drive and two 8TB hard drives taken from the NAS for data evacuation.
After that, root@@agartha#mdadm --create/dev/md2 --level=linear --raid-devices=2 --force/dev/sdd3/dev/sde3 was forced to recognize it as raid.
mdadm--detail/dev/md2 results are as follows:

root@@agartha#mdadm --detail/dev/md2
/dev/md2:
        Version: 1.2
  Creation Time: Mon Mar 2206:05:26 2021
     Raid Level: linear
     Array Size: 15618876176 (14895.32 GiB 15993.73 GB)
   Raid Devices—2
  Total Devices—2
    Persistence—Superblock is persistent

    Update Time:Mon Mar 2206:05:26 2021
          State—Clean 
 Active Devices—2
Working Devices—2
 Failed Devices: 0
  Spare Devices: 0

       Rounding—0K

           Name: agartha:2 (local to host agartha)
           UUID:0cda94d3:8680a2c0:d27bac03:230a29b4
         Events—0

    Number Major Minor RaidDevice State
       0 8510 active sync/dev/sdd3
       18671 active sync/dev/sde3

The created device /dev/md2 is recognized as btrfs, but cannot mount to NAS.
Please let me know if there is any way to mount it.

The first is the output when you try to mount.

root@@agartha #mount-o usebackuproot, ro-t btrfs/dev/md2/share/recovery/
mount —mounting/dev/md2 on/share/recovery/failed —Invalid argument

root@@agartha#dmesg | tail-n 20
[78678.255730] BTRFS info(device md2): trying to use backup root at mount time
[78678.255738] BTRFS info(device md2)—disk space caching is enabled
[78678.255741] BTRFS info (device md2)—has skinny entries
[78678.915376] BTRFS error (device md2): bad tree block start 0 14031240937472
[78678.922698] BTRFS error (device md2): bad tree block start 0 14031240937472
[78678.922710] BTRFS warning (device md2): failed to read tree root
[78678.923097] BTRFS error (device md2): bad tree block start 0 14031240937472
[78678.923903] BTRFS error (device md2): bad tree block start 0 14031240937472
[78678.923914] BTRFS warning (device md2): failed to read tree root
[78678.924230] BTRFS error (device md2): bad tree block start 13824487579079845761 14031240953856
[78678.924532] BTRFS error (device md2): bad tree block start 13824487579079845761 14031240953856
[78678.924548] BTRFS warning (device md2): failed to read tree root
[78679.176363] BTRFS error (device md2): bad tree block start 7429048968299861396 14031246639104
[78679.184713] BTRFS error (device md2): bad tree block start 7429048968299861396 14031246639104
[78679.184738] BTRFS warning (device md2): failed to read tree root
[78679.198012] BTRFS error (device md2): bad tree block start 18400797589989218529 14031240364032
[78679.206372] BTRFS error (device md2): bad tree block start 18400797589989218529 14031240364032
[78679.206390] BTRFS warning (device md2): failed to read tree root
[78679.255045] BTRFS error (device md2): open_ctree failed
root@@agartha#

Output from inspecting /dev/md2.

root@@agartha#btrfs inspect-internal dump-super --full/dev/md2
superblock —bytenr=65536, device=/dev/md2
---------------------------------------------------------
csum0x65426197 [match]
bytenr65536
flags0x1
            (WRITTEN)
magic_BHRfS_M [match]
fsid cd57473e-0800-4eaf-ac5d-761a99bb7d87
label           
generation514412
root14031240937472
sys_array_size129
chunk_root_generation513425
root_level1
chunk_root21004288
chunk_root_level1
log_root0
log_root_transid0
log_root_level0
total_bytes 15993730498560
bytes_used 11979407200256
sectorsize 4096
nodesize16384
leavesize 16384
stripize 4096
root_dir6
num_devices1
compat_flags0x0
compat_ro_flags0x0
incompat_flags0x163
            (MIXED_BACKREF|
              DEFAULT_SUBVOL|
              BIG_METADATA|
              EXTENDED_IREF|
              SKINNY_METADATA)
csum_type0
csum_size4
cache_generation514412
uuid_tree_generation514412
dev_item.uuid0e36f3ba-e6fa-479b-aabd-ce46ef97211f
dev_item.fsid cd57473e-0800-4eaf-ac5d-761a99bb7d87 [match]
dev_item.type0
dev_item.total_bytes15993730498560
dev_item.bytes_used12284705374208
dev_item.io_align4096
dev_item.io_width4096
dev_item.sector_size4096
dev_item.devid1
dev_item.dev_group0
dev_item.seek_speed0
dev_item.bandwidth0
dev_item.generation0
sys_chunk_array [2048]:
    item0key(FIRST_CHUNK_TREE CHUNK_ITEM20971520)
        chunk length 8388608 owner2stripe_len65536
        type SYSTEM | DUP num_strips2
            strip0 devid1 offset 20971520
            devuuid:0e36f3ba-e6fa-479b-aabd-ce46ef97211f
            strip1 devid1 offset 29360128
            devuuid:0e36f3ba-e6fa-479b-aabd-ce46ef97211f
backup_roots[4]:
    backup0:
        backup_tree_root:14031240953856gen:514411 level:1
        backup_chunk_root:21004288 gen:513425 level:1
        backup_extent_root:14031240478720 gen:514411 level:2
        backup_fs_root: 29753344 gen:9 level:0
        backup_dev_root:664829952 gen:513425 level:1
        backup_csum_root:14031240396800 gen:514411 level:3
        backup_total_bytes —15993730498560
        backup_bytes_used: 11979407200256
        backup_num_devices:1

    backup1:
        backup_tree_root:14031240937472gen:514412level:1
        backup_chunk_root:21004288 gen:513425 level:1
        backup_extent_root:14031242280960gen:514412 level:2
        backup_fs_root: 29753344 gen:9 level:0
        backup_dev_root:664829952 gen:513425 level:1
        backup_csum_root:14031242854400gen:514412 level:3
        backup_total_bytes —15993730498560
        backup_bytes_used: 11979407200256
        backup_num_devices:1

    backup2:
        backup_tree_root:14031240364032gen:514409level:1
        backup_chunk_root:21004288 gen:513425 level:1
        backup_extent_root:14031236874240gen:514409level:2
        backup_fs_root: 29753344 gen:9 level:0
        backup_dev_root:664829952 gen:513425 level:1
        backup_csum_root:14031237038080gen:514409 level:3
        backup_total_bytes —15993730498560
        backup_bytes_used —11979407216640
        backup_num_devices:1

    backup3:
        backup_tree_root:14031246639104gen:514410level:1
        backup_chunk_root:21004288 gen:513425 level:1
        backup_extent_root:14031244722176 gen:514410 level:2
        backup_fs_root: 29753344 gen:9 level:0
        backup_dev_root:664829952 gen:513425 level:1
        backup_csum_root:14031244787712 gen:514410 level:3
        backup_total_bytes —15993730498560
        backup_bytes_used: 11979407196160
        backup_num_devices:1

Add March 24th:
Since /dev/md2 was recognized as btrfs, we chunk-recover as btrfs rescue chunk-recover-y-v/dev/md2>fslog&.
The result is

Chunk: start=14710292348928, len=1073741824, type=1, num_strips=1
      Stripes list:                                                   
      [ 0] Stripe: devid=1, offset=13076065681408                                                                                                   
      No block group.                                                                                                                                   
      No device extent.                                               
  chunk: start = 14711366090752, len = 1073741824, type = 1, num_strips = 1
      Stripes list:                                                   
      [ 0] Stripe: devid=1, offset=13077139423232                 
      No block group.                                                       
      No device extent.                                               
                                                                      
Total Chunks—11590                                         
  Recoverable: 11429                                         
  Unrecoverable: 161                                                 
                                                                      
Orphan Block Groups:                                                  
                                                                      
Orphan Device Extents:                                                
                                                                            
Chunk tree recovery failed

and failed.
After that,

root@@agartha#btrfs check/dev/md2
checksum verify failed on 14031240937472 found17F1B7E5 wanted0000000000
checksum verify failed on 14031240937472 found17F1B7E5 wanted0000000000
checksum verify failed on 14031240937472 found17F1B7E5 wanted0000000000
checksum verify failed on 14031240937472 found17F1B7E5 wanted0000000000
bytenr mismatch, want=14031240937472, have=0
Couldn't read tree root
Couldn't open file system
root@@agartha# 

I tried btrfs check, but as mentioned above, there is an error in checksum.

Additional March 27
btrfscue https://github.com/cblichmann/btrfscue
I found a tool called
I'll try it now.
However, you must create a disk image with ddif=/dev/md2 of=diskimage.dd.I'm worried that the NAS is running out of capacity

linux raid

2022-09-30 16:51

1 Answers

By using btrfscue, we were able to mount it.
The tools required are btrfscue, ddrescue, fusermount.

First, make it possible to use fusermount.

root@agartha#ln-s/opt/bin/fusermount/bin/
root@agartha# 

Then, ddrescue the disk volume into an image file.

root@agartha#cd/share/public/recovery
root@agartha#/opt/sbin/ddrescue-r1-n -- verbose/dev/md2rescue.dd map
GNU ddrescue 1.20
About to copy 15993 GBytes from/dev/md2 to recovery.img.
    Starting positions: infile=0B, outfile=0B
    Copy block size: 128 sectors Initial skip size: 128 sectors
Sector size: 512 Bytes

Press Ctrl-C to interrupt
Initial status (read from mapfile)
reserved: 15384 GB, errorsize:0 B, errors:0

Current status
reserved: 15384 GB, errsize: 0 B, current rate: 0 B/s
   ipos : 15544 GB, errors : 0, average rate : 0 B/s
   opos: 15544 GB, run time:3s, remaining time: n/a
time since last successful read—3s
Copying non-tried blocks...Pass1 (forwards)

root@agartha# 

Use btrfscue to parse and mount image files.

root@agartha#/opt/sbin/btrfscue identity rescue.dd
93901/93901 [------------------------------------------------------------------------------------------------------------------------------------------------- 100.00% 65 p/s
fsid count entropy block size
cd57473e-0800-4eaf-ac5d-761a99bb7d872264.0000008192

root @agartha#/opt/sbin/btrfscue recon --append --metadata meta.db --verbose --id cd57473e-0800-4eaf-ac5d-761a99bb7d87resque.dd
15384765726720 / 15384765726720 [------------------------------------------------------------------------------------------------------------------------------------------------- 100.00% 526584 p/s
root@agartha#/opt/sbin/btrfscue --metadata meta.db-v mount/share/recovery/
btrfscue —no device file give, only inline file data will be visible
mounted rescue FS on/share/recovery/

Check the mounted directory in another terminal.

root@agartha#ls-l/share/recovery/
total 11196184
-r --r --r --1 root users 11476168704 Apr 1304:04 metadata
drwxr-xr-x1 root root 38 Nov 14 2019 rescue
root@agartha#du-h/share/recovery/*
10.7G/share/recovery/metadata
0/share/recovery/resque
root@agartha# 

Use Ctrl-C to remove the mount.

^Cbtrfscue:got signal, unmounting...
root@agartha# 

Added May 15, 2021
Mounted in btrfscue was a file format for rescues, not btrfs itself.
It seems that the metadata contains the results of scanning the disk, but I couldn't find out any more


2022-09-30 16:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.