Unformat ext4 file system HDD


#1

Hi community,
Been stupid accidentally formatted the HDD in my WD mycluud NAS.
Is there any way to unformated. It is 8TB WD red - file system is ext4.
Thank you


#2

you mean you accidentally deleted your stuff ?


#3

While I didn’t have to use it on a reformmated drive, the tool PhotoRec is recommended in this use case (see here and here.
Wish you good luck!


#4

Not exactly…
the files are there, but the file table is deleted. I can restore the files but not the file structure (folders and subfolders). this is 8TB of data… it will take forever to put everything back in order.
I am looking for solution that will restore the file table.


#5

Huh? Could you elaborate a bit more?


#6

I can extract the content of the disk with file restoring soft on another disk, but the original names are changed and and I need to go from file to file to check what it is… and there are millions of files - docs, music, films, pics…
I am looking for solution that will restore the disk in it’s original state


#7

Could you explain what you did to format the disk? What operating system did you do it in? I’m not sure exactly what would happen to remove the entire file tree, but still leave the files behind.

Since you said it was formatted as ext4, I’m going to assume this is linux. There’s always the fsck bash command, which, if you’re running it from a linux bootable usb, may be able to repair the file system.


#8

It is MyCloud EX2 Ultra -NAS system from WD – with 2 HDD (JBOD). By mistake formatted (quick Format) the disk that was full with data. The access to the system is through my desktop PC.


#9

What OS are you running on your desktop then? And by what steps did you “quick format” the disk? If you’re not running linux on your desktop, I suggest booting to a linux usb and first seeing if you can see any files on the disk, then try using fsck (with some googling to find the proper conditions) to check and repair the file system.

Also, do you know if you had RAID configured on the NAS? If so, that may help.


#10

No need for all this info. It’s very simple.Hejust formatted it. No matter what tools you use, a normal disk format procedure does not delete actual files. That would be a waste of time in most cases, because you can just ignore the old data. It’s often called a quick format. To actually delete the files, you need to overwrite everything byte-by-byte. Very few people do that.

And running fsck might make it worse. It won’t help, that I know for sure. It will try to repair the new file system, not the old one. The old one is deleted, it doesn’t exist. So there’s nothing to repair. What he needs is a tool that goes through the drive byte by byte, just like those recovery tools, and instead of giving him a list of files, rebuilding the partition.

Answer below :slight_smile:

@Constantine I’m afraid that is impossible, because the part of hard drive containing the file names and locations got overwritten by the new file system. Parts of it could probably be recovered, but it’s not enough to re-create the whole partition. You would still have to recover those files manually.


#11

@Constantine you won’t be able to restore the file names because like Paul said. that file table was overwritten. That information is held near the start of the partition and would now hold the near file table.

Just don’t write to it. You can probably get most of your data but with nonsensical names


#12

Are the recovered file names totally random? Or is there some logic behind the changed file names?

Do the recovered files still have their other information intact? Information like date created and file extension?

As @pauliunas explained, the directory entry is deleted and cannot be recovered.

But if the other information about the files are intact, then you should be able to sort them. At least you would get some order in the chaos and know which files are pics, music, films, docs etc. and when they were created/modified.

It’s a lot of detective work unfortunately and a good brain exercise trying to remember what you did then and when.

Hope this helps and good luck!


#13

Ooops. I had the exact same issue. I deleted an XFS partition in a RAID 1Tb hard drive with crucial (and not-backed-up) information from my company. Quite a complicated scenario, not being your typical FAT32 partition. Gosh, I didn’t sleep in almost a week after that, and tried everything I could to repair it. And finally I managed to do so!

I tried many commercial recovery programs, but they were really expensive. I was desperate enough to pay a lot to fix this, but even the trial versions were so limited that I couldn’t be sure they would be useful at all.

And then, free software came to the rescue. I found TestDisk. It’s made by the same guy that makes PhotoRec, but TestDisk can recover the full filesystem structure in place, instead of finding and copying file by file. If I understood correctly, it finds existing (and deleted) partitions without even looking at the partition table, figures out their original format, and then re-creates the partition table to include those partitions. All through CLI, but easy enough for a non-expert like me to get out of the big mess I had created.

Edit: LOL, I even found the message I sent to the developer afterwards, together with a relieved Paypal donation.

I hope it does the same job for you.


#14

thank you :slight_smile:
Will look in to when got home tonight
Cheers


#15

Before doing ANYTHING: If the data is really important to you: Use an new disk (if necessary buy one) and extract the data you can restore to it. Otherwise you might loose everything while trying to repair the disk. See it like this: You got lucky that you can still restore your data. Even if it’s unbelievably much work, you could restore everything.

For reasons like this: First restore the data to a free disk. Then try to repair the old disk.

edit: maybe an even better idea: mirror the disk sector/block-wise to get the exact same disk content, then try to repair the new copy without changing anything on the old disk. file based operations could loose information because the file table is gone.


#16

Just curious, @Constantine. Did you manage to recover your data?


#17

Hey guys, if you haven’t written on the drive, there is free software that can help you recover even if it has been formatted.

easeus has some free software (even if it’s formatted, the tables and file names should still exist). Normally quick format just deletes the first character (similar to delete).

https://www.easeus.com/resource/unformat.htm

If you have written over it, a professional service can often times recover some/most of the information, but they need to know what type(s) of files. They normally charge hundreds of dollars for this service, but if it’s photos or video, it can be worthwhile.

The recover picture finders are also useful. If it’s mostly pictures I can probably find the programs I used to try recovering. They were pretty (surprisingly) fast and effective.


#18

Unfortunately - did not :frowning:


#19

Sorry to hear that :confused:


#20

Also have a try with this Recoverit for Mac, maybe some helps