I recently encounted an i/o error on my backup NAS drive, so I ran fsck. It indicated a bad superblock so I ran sudo fsck -b 8193 /dev/sdc1 and answered y to fixes. Now I get this:
pi@rpi4b:~/Downloads/complete $ sudo fsck.ext4 /dev/sdc1 e2fsck 1.44.5 (15-Dec-2018) NAS8: clean, 22591/244191232 files, 1356495135/1953506304 blocks pi@rpi4b:~/Downloads/complete $ sudo mount -t ext4 /dev/sdc1 /mnt/NAS pi@rpi4b:~/Downloads/complete $ ls /mnt/NAS lost+found pi@rpi4b:~/Downloads/complete $ sudo ls /mnt/NAS lost+found pi@rpi4b:~/Downloads/complete $ sudo ls -a /mnt/NAS . .. lost+found pi@rpi4b:~/Downloads/complete $
Where are my missing 22591 files? Can I recover them? I am running updated buster on my raspberry pi 4b w/ 4Gig. Thanks. --Steven
/lost+found is normally empty on a clean partition with no disk errors
So, why do you think there are no files or directories on your NAS disk since you apparently haven't run "sudo ls /" or "sudo df -h"?
How many files were you expecting to see? Occupying how many GB? Does "df -h" show anything like you expect? How long is it since your last backup of the NAS disk(s)? How many data/files/directories have you created or changed since your last backup?
How how much irreplaceable stuff would you loose if you:
- check the NAS disk partition(s) and replace any that are damaged. Use parted or gparted for this: use parted if you're running the NAS via a terminal console or gparted if you're using a graphical desktop.
- reinstall the NAS OS from scratch
- restore the contents of the /home directory from your last backup
So, have a look at your RPi's filing system as I suggest above, work out how much important stuff stuff you've lost and then work out a recovery plan and execute it.
This is what I do and, since I'm paranoid about making backups and keeping them offline in a firesafe:
- My house server is backed up overnight every night to a permanently connected external USB drive for protection against finger-trouble.
- All my computers and backed up weekly to two generations of USB drives which are kept offline in a firesafe.
As a result I haven't lost any data I care about despite having had several disk drives fail permanently over the last 30 years or so.
I hope this gives you some ideas about what to look at and determine whether the NAS drive is recoverable and, if it is, how to do a partial restore to it.
--
--
Martin | martin at
Gregorie | gregorie dot org
Because "ls /" would show the root filesystem of the machine (irrelevant) and the OP did mount the affected disk on /mnt/NAS, and then did
ls /mnt/NAS
which showed an empty disk has been mounted, save for lost+found (which I suggested they look *inside*, not just squint *at* as they've done so far!)
22591. As per fsck's claim that there are 22591 files in the fscked-up filesystem (hiding!)
Tips about restoring /home etc. may be a red-herring here, as there is no indication there is anything *wrong* with /home, or the / filesystem, proceed with caution.
Make very sure you know WHICH filesystem you are mounting/fscking/wiping/restoring before doing it.
The best time to shoot yourself in the *other* foot, is when you are just recovering from shooting yourself in the first one!
--
--------------------------------------+------------------------------------
Mike Brown: mjb[-at-]signal11.org.uk | http://www.signal11.org.uk
--
> Mike Brown: mjb[-at-]signal11.org.uk | http://www.signal11.org.uk
Thanks to all. I found all the missing folders in lost+found with #inode-n
umbers. It was easy to move those folders into the main directory and rena
me to original names as best as I remember. All seems well now. I just go
t this 8TB drive for christmas and am hoping it is not dying already. I le
arned about lost+found in this adventure. I always wondered what it was us
ed for. I found that fsck did a better job than gparted for resurrecting d
rive.
--Steven
Be thankful it was just a few folders -- you could have had 22,000+ *files* in that condition!
The more sane equivalent of when DOS used to dump FILECHK.000 FILECHK.001 etc. all over the root of your C:\ Drive.
"Found 1783 lost clusters in 832 chains, convert to files? [Y/N?]"
Bad times ... :(
fsck can check (and repair). It can also sometimes check and destroy, in its attempt to repair. There are no guarantees, so make backups. Someday you'll need it.
Now, go and learn about "smartmon tools" and "smartctl" just to check that the new drive isn't *actually* dying! :)
--
--------------------------------------+------------------------------------
Mike Brown: mjb[-at-]signal11.org.uk | http://www.signal11.org.uk
Glad to see in the thread that you have located & recovered your files
as a side topic another good recovery tool is photorec
it will scan a drive (even if the partitions have been removed) & recover anything that looks like a datafile it recognises - you will unfortunatly loose the file names.
also be very careful who you let have your disk, this app will also recover files you did not want recovering (as one young lady at work discovered when she asked for assistance recovering lost photos), fortunately the engineer who recovered the data for her was a gentleman & they did not go any further.
I assume you now always run fsck on the backup disk after the backup and that you use a cycle of at least two disks for each set of data that you back up.
-- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. |
Hopefully, not the sort of "backup" as mis-used in the sentence :-
"I moved all my critical work files off my main machine onto my external backup drive, which has now fallen off the desk and is making grinding noises. How do I recover my backup?"
Key word that gives me chills: "moved". Uh oh.
Did you mean copied?
"No, moved, to make space" ...
(Uh oh)^2 ...
--
--------------------------------------+------------------------------------
Mike Brown: mjb[-at-]signal11.org.uk | http://www.signal11.org.uk
Other people's near misses and disasters, or your own.
smartmon + RAID has saved my backside more than once when "Pending Sectors" have become "Uncorrectable Sectors" and in one case "Drive? What Drive?"
smartmon (without RAID) has flagged up problems with a disk with loss of two (2) files, both easily recovered from a backup after cloning the failing disk (as a first, fastest-recovery strategy).
smartmon, however, has been utterly unable to prevent or warn about SD cards in a R-Pi dying without warning (once) or Pi USB memory sticks (twice) because that's not in its remit :(
So, back to the backups it is.
--
--------------------------------------+------------------------------------
Mike Brown: mjb[-at-]signal11.org.uk | http://www.signal11.org.uk
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.