× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Stanman130
Guide

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

How to Mount Degraded BTRFS Volumes - RAID 6 - Two Hard Disks Missing

I just did a quick test of the degraded array with one disconnected hard disk. I shut down the machine normally and reconnected the missing hard disk. Upon start up, the array was identified and assembled normally. The array behaved as it did in the first test of the FlexRAID RAID 6 array and the array was assembled automatically during boot up. All that was needed was just to mount the array using "mount -t btrfs -o ro /dev/md127 /mnt" and then the test files were accessible. So an array can apparently be started up with a missing disk and if the missing disk is added back in, it rejoins the array without requiring a rebuild or any repairs.

Then I shut down the system and disconnected ReadyNAS disks 2 and 4 from the motherboard to simulate a double hard disk failure.

Following the exact same procedure as used for the "One Hard Disk Missing" recovery above - everything worked the same.

Stop the auto-assembled arrays.

Re-assemble the data array using the UUID and the "--run" switch.

Then mount it the same way. The data was again copied to the home folder and it passed verification with SHA1 sums. 😄 😄 😄

RAID 6 does allow 2 disks to be removed from the array and the degraded array can still be mounted and the data recovered. 🙂

Note the following cautions:

1) This is a pretty ideal situation. There is no data corruption from viruses, worms, malware or hardware malfunction. The drives were cleanly removed from a shut down system and suffered no lingering data corruption or slow failure. The success of this recovery method does NOT mean that backups aren't necessary - backup your data! :x

2) The array gets very slow when it's in a degraded state. Copying 17 Gb of test data is not the same as moving 3.6 Tb of data (the full formatted size of the array). Data recovery will need lots of space and lots of time. A fast processor and plenty of RAM will help (ie. don't assume you can use an old, slow, junk PC to recover your data). And don't forget the cooling or you might have a catastrophic failure in the middle of your recovery process.

3) The mdadm and underlying BTRFS filesystem appears to be pretty robust (keeping in mind caution number 1!) But I'm not enough of a Linux expert to know where the "gotchas" are in this process. This is definitely a "last resort" process. Try all the normal ReadyNAS repairs and recovery techniques first before resorting to this method.

4) Don't be afraid to ask for help. There are a lot of knowledgeable people on this forum (thanks everyone! 🙂 ) and a lot of related information floating around at various sites. Most important of all - Don't Panic! Always start by gathering information first and if you're not sure about the changes you're making, ask questions and get help BEFORE you make them. Some are irreversible. I always try all the non-destructive methods first before I start changing settings or zeroing superblocks. I didn't risk any data in this testing and I'm glad I found out how to do this BEFORE I might need to do it. Test thoroughly before making permanent changes.

-Stan
Message 26 of 34
sweeney1
Aspirant

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

I have been recovering data from my failed 2-bay RN102 using mdgm's suggestions above.

# apt-get update
# apt-get install mdadm btrfs-tools
# mdadm --assemble --scan
# cat /proc/mdstat
# mount -t btrfs -o ro /dev/md127 /mnt

It worked without any problems on the first disk, but when I tried to do the same with the second disk (just to try it), mdadm would not activate the data and swap partitions - only the root partition. data and swap were marked as "Inactive" and the disk was marked as 'Spare' in cat /proc/mdstat

After a lot of reading up on mdadm, what finally worked for me, was to use the "mdadm --stop ..." command after I was finished using one of the disks - that is

# mdadm --stop /dev/md127
mdadm: stopped /dev/md127

After doing this on both swap and data, "mdadm --assemble --scan" was able to activate all raid-partitions.

When a raid disk is only mounted to recover data, isn't it correct and necessary to stop the raid partitions (sorry for my wrong terminology) to be able to mount another raid disk?

Regards

Hans-Ole,
DK
Message 27 of 34
mdgm-ntgr
NETGEAR Employee Retired

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Well in the ReadyNAS at least if you have several separate volumes they could be mounted concurrently.

Was your volume an X-RAID or RAID-1 volume or were you using a separate volume for each disk?

With just the one volume if the partitions are out of sync then mdadm will typically choose to start the array using one disk not the other. So if you want to try the other partition in such a case you would need to stop the array and start the array again specifying the partition on the disk you want to use.

The root and swap use RAID regardless of whether that is used for the data volume.
Message 28 of 34
ArctiX
Aspirant

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Hey all,

First of all, just want to thank you for this thread, even almost three years on - it's still very helpful!

I understand I'm resurrecting an old thread here, but having trouble with copying data/migrating to the readynas rn102.

Using the below method I have been able to mount the readynas drives in a standard Linux machine (running Ubuntu Linux Mint 18.1) and then copy data across to the drive locally.
As I'm copying about 4tb of data, I didn't want to do this over the network.
# apt-get update
# apt-get install mdadm btrfs-tools
# mdadm --assemble --scan
# cat /proc/mdstat
# mount -t btrfs -o ro /dev/md127 /mnt
Then copy the data through gui on linux

I can successfully copy data to the drive, and then still mount the drive through the NAS (without it reformatting the drive).

My only issue is, the NAS can't see the new data. Not through SMB share, nor through the browser frontend.

I can still take the drive out and read the data in the Linux machine, so it leads me to believe it could either be a file attributes/access issue, or some sort of indexing file of the NAS not updating.

I can even create a folder on the NAS and remount in Linux to see it. Just not the other way around.

Has anyone come across this before?

I'm not all too savvy with Linux, but can follow command line.
Is there something I'm missing regarding file attributes? Or does the NAS have a built in drive indexing I can access?

Thanks in advance

- Matt
Message 29 of 34
mdgm-ntgr
NETGEAR Employee Retired

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Shares on the NAS need to be created using the web admin GUI so don't create a folder directly within the data volume using some other method. Once you've copied the files across depending on which method you use it may be necessary to reset the ownership/permissions.

Message 30 of 34
ArctiX
Aspirant

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Thanks mdgm for the reply.

 

I'm at work at the moment, but I'll give that a try when I get home.

 

Is this applicable to folders within folders as well? For example, if I created a folder on the NAS to share, then copied files in folders to the shared folder - would they be accessible?

 

Secondly, I had also tested copying from linux using a video file into an existing shared folder. Strangely, even though I could view the rest of the contents in the shared folder which was copied via SMB, the newly copied video file did not appear.

 

What is the suggested way of local copying from a linux distro? And how would you also reset the permissions from the RN102?

 

EDIT :  I am running 2x 3TB disks as single JBOD volumes. Network access is via both AFP and SMB through Mac/Windows respectively, and the same behaviour occurs on both drives.

 

Thanks again for your help,

Model: RN102|ReadyNAS 100 Series
Message 31 of 34
mdgm-ntgr
NETGEAR Employee Retired

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

It sounds like the ownership/permissions of that video file must be messed up. If you create a folder within a share you'd need to create it using appropriate ownership/permissions.

How exactly did you copy the file across using SMB? Did you did using the GUI?

 

You may wish to see e.g. How do I restore default file and shared folder access rights on my ReadyNAS OS 6 storage system?

Message 32 of 34
ArctiX
Aspirant

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Hey mdgm, thanks heaps for your help!
You're completely right! It was the combination of not creating a share folder in the NAS first, and also incorrect permissions for the video file.
I reset all owner/permissions for the folders/files recursively using
Chown -R admin <folder>
Chmod -R 755 <folder>

I'll probably look at setting correct permissions that coincide with the network through the frontend. As suggested with your link.

Thanks again for your help!
Message 33 of 34
NuchDog
Aspirant

Re: OS6 Data Recovery - How to Mount BTRFS Volumes

Another option that I have successfully used to transfer/recover data from my RN312 using a standard Windows PC is an external hard drive reader (https://www.amazon.com/gp/product/B00APP6694) and recovery software capable of mounting BTRFS:

http://www.reclaime.com/library/netgear-recovery.aspx

 

Long story short, I had to factory reset my RN312.  I left 1 drive in and performed the factory reset. Using the above software I was able to then copy all of the data back onto the now factory reset RN312 before reinserting the second drive.

 

For anyone looking for a quick BTRFS recovery, this worked well for me.

Model: RN31200|ReadyNAS 300 Series 2-Bay
Message 34 of 34
Top Contributors
Discussion stats
  • 33 replies
  • 19483 views
  • 2 kudos
  • 9 in conversation
Announcements