Yup, this is a data recovery tale... Yup I was dumb. And if you are reading this then I have sympathy for you because you probably came here after something horrible has happened to you... Hopefully this is some help.
I use my DNS320L as my archive for all my documents and family photos and videos. Valuable data.
Do I have a backup... sort of... at least for the pictures and videos... sort of...
I decided long ago that SD cards were like film negatives. You don't erase them and reuse them, you buy new ones. After all, I was paying $10 for a roll of film that held 36 pictures, its really pretty cheap to pay $10 for an SD card that holds 2000 pictures. (Ok, back when I started they held 2000 pictures, then the cards got bigger and they held 4000 pictures, then the resolution got better and they hold 2000 again... whatever...)
But as good as that sounds, it would still be a huge amount of work to recopy all the images from SD cards, especially since as I took images from SD cards I organized them into folders for each event with date and time and description... That's a LOT of organizing since 1990. Add to that that the realistic lifetime of data on SD cards is less than one might expect and many of my SD cards were past their "best before" date.
back to my tale of grief...
I was running out of space on my DNS 320L NAS with 2 3TB drives in it (configured as RAID 1 in case one drive failed) so I had 3TB space and only 240GB left free. I might add that when the DNS320L gets low on free space it does weird things like stops responding, hangs, has trouble authenticating etc.
My solution to lack of space was to buy another DNS320L. Saw one on Kijiji had one for $30cdn so I grabbed it and 2 new Seagate barracuda 4TB drives to stick in as they were the best space for the buck at this time.
So with the arrival of the new NAS I decided to do some "cleanup" including network config to get all my NAS devices on fixed sequential IP addresses so I knew where they were on the network and some NAS naming config to make them similar, SRVR became SRVR1 and the new one became SRVR2 etc... general cleanup... so I was working in the web interface on each device and I was configuring the new drives in the new NAS for a RAID 1 configuration and yup, you guessed it, I was on the wrong tab in my browser and formatted my old NAS with all my data on it.
Clicking X in the user format status window after you have said OK just closes the window, it does NOT stop the format. You DNS320L is still working on the task. You told it to format. It warned you it would erase data, you said YES.
So the family got to see me do the 100 yard dash from the livingroom to the basement where the NAS is located to power it off. Once powered off I then went to change underwear. I knew what I had done. If you were not this lucky and the partition and format finished, read the end of this long post before getting your hopes up.
I set about searching on Google for recovery solutions.
Googled things like
DNS320L accidental format
NAS format recovery
Can I recover an accidentally formatted NAS disk
Very quickly learn:
D-Link NAS devices use EXT4 file system (Linux) so Linux tools may work
There are actually many Windows tools for EXT4 recovery.
RAID 1 is a lot easier to recover than RAID 5
Recovering from WORKING drives is a lot easier than recovering from failing drives.
I started looking at recovery software.
BONUS: Cyber Week is a GOOD week to look into buying recovery software…
The first search that sounded promising was Home NAS Recovery (http://www.nas-recovery.software/) for $69US. I opened a case with them asking if their product would recover. UPDATE: they finally replied... after I was finished recovering all my data using R-Linux... Their reply was "It is difficult to predict the chances of successful recovery, but anyway you should try. Home NAS Recovery should work with such device model". I call that underwhelming and less than timely.
I also found EASUS has a recovery tool that claims to recover EXT4 disks. I started a live chat with them and they said they cannot recover from a NAS device, the disk would have to be a local disk. I knew that, said no problem, the live chat person had little technical knowledge beyond that and basically said try with the free download and it will tell what you can recover (but will only recover 500MB for free, on sale for $69US). I did try it and it found files and I was able to preview them and saw pictures and videos… there was data to be recovered. But file names were random and there was no folder structure. Maybe I did something wrong... but I kept looking at other options. But, it was able to scour the space and find various files like pictures, videos, documents etc. More on this near the end...
I found a freeware tool called R-Linux. Looked promising. https://www.r-studio.com/free-linux-recovery/
I used the Windows variety as most of my home machines are Windows, but I would have set up a Linux box or used my Mac if that was the only option.... be prepared to be flexible.
A few more things to note:
Recovery software is not going to talk to your NAS device. You will have to take the drive out of the NAS box and make it a local disk on the machine you are doing the recovery from.
Recovery programs take a LONG time to just to scan 3TB disks looking for things to recover.
Recovery itself is an even longer process.
It appears data recovery software finds data files but not file structures if I read the descriptions correctly. I may get all my stuff back but lose my organization. That is only slightly better than losing it all… see previous note about organization. We are talking hundreds of thousands of files in thousands of folders.
I took one of my RAID 1 drives out of the NAS box and installed it directly into my desktop PC running Windows 7 that was now dedicated to recovery. SATA connected, maximum speed. DO NOT LET ANYTHING write to that drive. Do not install anything on that drive. Do not initialize it if Windows asks you to. Do not worry about the fact that it doesn't show up as a disk in My Computer or that Disk Manager shows it as empty or uninitialized or anything. This is an EXT4 formatted disk that is a Linux format not a Windows format and it takes special software to understand it. recovery software. And when recovering files, they MUST be recovered to a new location somewhere. You cannot write them to the drive they came from. You will wipe out any chance of recovering data if you write to your NAS drive that you are trying to recover.
So I installed R-Linux freeware on my C: drive, NOT my NAS drive... (windows can't read it so little worry about that but the warning is worth repeating, DO NOT WRITE TO THE NAS DRIVE)
R-Linux said it was going to take hours just to scan the drive but seemed to finish in less than 2 hours.
First glimmer of hope after the scan finishes… R-Linux found a partition and from what it shows I see file structure. The data gods threw me a bone.
So the folder names in the ROOT of the drive were lost so R-Linux makes up unique names for them. I had only about 10 folders there, the rest were under those and all those folder names were intact. All the file names were present. My file structure organization was not lost.
So then I started the recovery process. Fortunately I had a new NAS box with 4TB RAID1 storage available... doh...
I let it run for a while and went to another PC and had a look at SRVR2 my new NAS box to see what it had found. Things were coming back. It looked amazing. I was able to sleep soundly that night, the cold sweats had stopped. There was hope.
Looking at things close I was even more surprised to see that the original file time stamps were preserved in recovery.
It is worth mentioning that in the interest of letting the process run unattended I did select some advanced R-Linux recovery options, like if a file already exists then rename and keep both, if hidden attribute is found keep it and don't prompt. basically I did not want it to stop and prompt and have me decide, I wanted it to run and run and run.
I am almost 24 hours into my recovery, I have about 1/4 of the data recovered. The process will take 3-4 DAYS. This is why I took an unused PC and installed the NAS drive in that making it a local drive for the recovery process.
A few thoughts...
Do not hook the NAS drive using a slow connection like USB2. make it SATA or USB 3.0 or USB type C for some performance...
If you don't have a desktop PC to use for the recovery process and what you have isn't conducive to direct drive connection or you can't afford to have your current PC tied up for days doing a multi terabyte recovery, buy one... you can pick up a used Dell desktop for under $200 that will have a spare SATA drive bay and spending $200 is WAY WAY cheaper than a data recovery service.
You may want the recovery PC on a UPS to avoid an outage and you may want to make sure the power management on your recovery PC is set to Performance and make sure it never sleeps or shuts down when idle. It will be idle for a few days doing recovery...
I may learn more as the recovery proceeds but at this point, seeing all my files and folders slowly return is the biggest relief I have had in a very long time.
Update:
Recovery has finished. Took two full days to restore 2.5TB from drive to new NAS. I am certain it would have been faster to recover to a local disk, but then I would have had to copy it to the NAS so probably about the same in the end. As far as I can tell ALL my data was recovered except one folder was named incorrectly. I have photos sorted by year and the 2018 folder was there but empty and there was a folder there named New Folder that had all my 2018 files in it. In short, I was one lucky SOB...
UPDATE: Have had longer to look through things and there are issues. It still appears all files were recovered, but the files are NOT all in their proper folders. I have a bunch of folders called "New Folder" in various places that contain pictures and videos that belonged in other folders. The other folders are there, but they are empty so it is a relatively easy task to move them, and I am still one lucky SOB, and this is nothing compared to having to recover all files from SD cards (and suffer losses for things I have archived from others that I do not have SD cards for). It appears that where things are not correct was places where after the fact I had done some folder cleanup. For example I had a folder named 2015 Pan Am Site and later I renamed the folder 2015-05-16 Pan Am Site. What I found was I had the Original folder with the pictures in it and an empty folder with the new name. Pretty easy to move the pictures into the new folder if you know what you are looking for, might be tougher if you were not familiar with the content. I was able to use things like Treesize to find 0 byte folders and those were areas I had to look at to clean up, find the right pictures, move them back where they shoud be and delete the old incorrectly named empty folder once the files were moved.
Once the recovery was finished and I had checked over my data I put the drives back in the original NAS box and configured it for RAID 1 and this time I did not do the mad dash to the basement to power off... I let it finish. What I noticed was that this time watching the progress monitor I saw the dialog box about partitioning the drive and then after a while it went to formatting and took about 15 minutes. Now that the format is finished I am going to rescan the drive and see what is recoverable AFTER the format finishes which I suspect may be the case for some unlucky soul that didn't realize and didn't jog down and power off immediately. Confirmed. After letting the format finish on the drive the R-Linux was unable to find my data on the drive. That high speed jog to the basement to unplug the NAS box appears to have been a VERY good thing to do and I am sorry if others were not as lucky. My instincts were good at the time of the crisis.
I have a feeling that there might still be files accessible, but without the file structure... in other words, a recovery program can scour the space and find remnants of files and piece them back together... That would have been a huge nightmare for me given the number of files and folders I had, but that may still be an option for some folks and I am now curious.
Since I currently have a spare empty NAS device, I am going to stick a couple of small drives in it, format them, write a bunch of data on them and then do a re-format and let the recovery programs go at them and see what I can see. Will update this post when done.