Need help with recovering folders/files after running e2fsck -f -v -C 0
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Need help with recovering folders/files after running e2fsck -f -v -C 0
Hi Guys,
I have looked around the forum to see if I can find similar posts with my problem. However not so much, so I opened this topic on my own.
What do I have and what did I do: I have a QNAP TS-509, firmware 4.0.2 Build 20130726, 4 x WD5000AAKS and 1 x Hitachi HDS725050KLA360.
The QNAP is in a windows domain network and there are a couple off shares on the QNAP with domain permissions.
Everything worked fine en still does.
The problem: File System not clean. Examination failed (Cannot unmount disk)
Solution: Go to Storage manager -> Current Configuration: Logical Volumes -> select RAID set -> click Check File System
Did this help? No not for me. Every time I rebooted I got the message back.
So I took it on myself to scavenger the internet for a solution. Eventually I found this:
If you get this message from your QNAP:
1 The file system is not clean. It is suggested that you run "check disk"
and after you start a disk check and you end up with message like this:
2 [Mirror Disk Volume: Drive 1 2 3 4] Examination failed (Cannot unmount disk).
or
3 Get the same message back over and over again.
You need to get into SSH and execute following:
1 /etc/init.d/services.sh stop
2 /etc/init.d/opentftp.sh stop
3 /etc/init.d/Qthttpd.sh stop
4 umount /dev/md0
5 e2fsck -f -v -C 0 /dev/md0
6 mount /dev/md0
7 reboot
8 After all of above, your QNAP NAS will reboot and everything will get back to normal.
Number 8 is is not necessarily true.
after number 5 I got a kind of matrix looking output, at that moment I just wanted to shoot myself for not making a back up first. When I try to think what was happening, there were corrupted files or some sort that he was repairing. I really don't know for sure anymore. When all was finished I executed 6 and 7 and everything seemed to be ok.
Not the case....
After a couple of days I needed some files from two specific folders, but these where nowhere to be found anymore. So I didn't lose any shares, I lost folders and the files within.
There where some folders and files that where lost, but they where nicely put in the @Recycle folder. Strangely the network share (where the two lost folders and the files where in, shows up in the shared folders section, but not in the file manager.
However the two folders that are missing are projects we are working on for customers and nowhere to be found anymore. We contacted Customer care of QNAP. The guy really tried his best, but told me to get a recovery program to see if I that could recover the folder and files.
I have tried using Photorec and testdisk (running now) but so far no luck. The files missing are mostly are .docx, .xlsx and .txt .docx and .xlsx aren't in testdisk or photorec.
Hopefully there is someone that can help me get my files back.
I maybe a Newby at this, but that was the first place I Looked
Unfortunately I can't find them anywhere. I tried TestDrive and PhotoRec but nothing.
I really do not have a clue what to do to get them restored.
I think the problem started with not trying to understand what the actual error was but trying to "fix" things from the user Interface. Next time the array gives you such problems, provided you now have a suitable backup scheme in place (and have actually tested restoring files!), first gather nfo with respect to kernel (warnings) ('dmesg', 'less /var/log/messages'), running processes ('lsof -Pwln'), status of your RAID and disk setup (see mdamd.conf / raidtab, 'cat /proc/mdstat', 'mdadm -D /dev/md0', 'fdisk -l'), do a --dry-run after umounting md0 ('e2fsck -n /dev/md0') and if and when you decide to run such a destructive check pipe output to a file ('e2fsck -f -v -C 0 /dev/md0 2>&1 | tee /dev/shm/fsck.log') for reference purposes. Same goes for Photorec: always first 'cd' to a location you can afford to write to (USB stick, never the Live file system) and always run it with the "/debug" and "/log" flags to have a log file to post.
There's no clue as to what the status of the NAS is but since you said "Everything worked fine en still does" and seem to have examined the file system I assert it's up and running and accessible again. That's a Bad Thing as journaling file systems are particularly quick re-allocating free disk space lowering chances of of recovery within seconds after the fact. So even if you would manage to start the recovery process right after you've remounted all disks read-only I'm sorry to say there's no guarantee whatsoever recovery may be (partially) successful.
It was a stupid mistake to not make a backup first. Reading about the error message and its solution I didn't think anything could go wrong. After I ran the commands I got a matrix kind of screen I have no idea what was going on, but it didn't feel good. after some time this stopped. I then mounted the raid set again and rebooted. The error message was gone. It was only after a couple of days I found out that some folders and files where missing. The strange thing was that other folders and files where dumped in @Recycle (a temporary recycle bin that can be activated in your QNAP). I didn't think I would be needing a backup system, because I was using a NAS. WRONG!
The solution I found to clear the error message on the NAS did the job. The message was gone, so where some files and folder. The NAS was and is running with no problems. I have copied everything onto a external back up to keep files and folders save and to keep the NAS clear of data reads and writes.
As I am a newbie I Googled for a solution to get my folders and files back. I found out how to use PhotoRec. I ran PhotoRec and now need to go trough all the files
What I want to know is there a way to just try and recover the share where the folder was in? I have a lot of files now to go trough because a have recovered the whole NAS.
As I am a newbie I Googled for a solution to get my folders and files back.
While this won't help you right now and while you couldn't possibly be faulted for doing that you have to remember always is to ensure you understand what's said, what the circumstances are and what the consequences are because the Internet is rife with stale, deprecated, incomplete HOWTO's, articels, web log and forum posts and such by both knowledgeable and sheer incompetent posters who assume you know what you're doing, care nothing about the results or just copy other peoples posts. Never take anything for granted, make it a reflex to question everything and do your own research. Self-reliance goes a long way.
Quote:
Originally Posted by Ch3shire
What I want to know is there a way to just try and recover the share where the folder was in? I have a lot of files now to go trough because a have recovered the whole NAS.
No, I'm afraid that won't work because any meta data is lost (as file names are listed in the drectories inode). Depending on what type of files you have what's left is to check log files, clients caches, backup copies (and Windows registry Hives if applicable) to piece things together.
thanks for the advice. I will never take anything for granted anymore and will stay a member of this community to learn and get a better insight into Linux. I recovered 1 TB of files which I need to go trough. I already found one document that was in the missing folder. So I hope I will be able to find more.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.