LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Files gone after FSCK! (https://www.linuxquestions.org/questions/linux-newbie-8/files-gone-after-fsck-4175611249/)

ConnM 08-03-2017 02:06 PM

Files gone after FSCK!
 
I have recently corrupted my hard drive somehow, and I am wondering how to fix it. I was installing some graphics drivers, as well as installing windows alongside Ubuntu that day, then Ubuntu suddenly would not boot, BIOS would not open(frozen boot screen for a minute) and then would enter grub recovery. I tried to boot from my hard drive through grub recovery but a weird message would pop up saying File system is unknown(NOT unknown file system).
This was happening with each partition on the drive. So I booted from a live usb and used fsck to fix the drive. After it was done everything was gone. I used TestDisk to recover the files, but i would never be able to sort the thousands of files without their paths. I looked through GParted at the hard drive that was supposedly empty, and I found one partition with 14 GB used(about the amount that I had on my computer beforehand). I re-checked the hard drive for any files, but I couldn't find any(I checked for hidden ones) lost+found was empty and there was no trash. I have no idea why this is and I need help!

UPDATE: In disk usage manager, it shows that their is no space used up.

Screenshot of Disk Manager: httphttps://i.stack.imgur.com/IOQbA.png
Screenshot of GParted: http://https://i.stack.imgur.com/FAhDW.png

AwesomeMachine 08-03-2017 03:11 PM

Could you give us the output of
Code:

$ fdisk -l /dev/sda
where sda is the corrupted drive.

ConnM 08-03-2017 03:16 PM

Yes, the output is:
ubuntu@ubuntu:~$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 byte

jefro 08-03-2017 03:29 PM

Might look as S.M.A.R.T info as well as run memtest. I like to think that drives don't go data bad like that.

ConnM 08-03-2017 04:31 PM

Gparted has a data recovery feature should i try that? or will that not save the paths as well.

AwesomeMachine 08-03-2017 07:34 PM

OK, that drive has no MBR partition table. Try using testdisk to recover the partition table.

Otherwise, you're just going to have to sift through the recovered files to find what you want to save.

There are a couple of tools to make this task easier.
Code:

$ file * > type.txt
will give you all the file types. You can sort that by type with
Code:

$ sort -k 2,2 type.txt > type1.txt
You'll need to make the two text files with touch.


Alternately, you can open the recovery directory using nautilus and sort by type.Then you can organize the files by type.

Once you know the file types you can use various programs to open, say jpegs, in batch mode, i.e. with gwenview. It's a tedious process. But if the files are worth anything, it's worth the time.

syg00 08-03-2017 07:37 PM

Let's have some data:
- the failed disk is /dev/sdc and was partitioned ?
- you ran testdisk and nominated /dev/sdd as the target ?.
- /dev/sdd, the device node, unpartitioned ? (just checking).
- let's see a "lsblk -f -o +SIZE" listing. Uneditted.

Testdisk doews what it can - there are scripts that attempt to give the files useful names using grep/exiftool that sort of thing. Even on the testdisk site IIRC. Its manual, and specific to your data. And takes some time.
Haven't used gparted for recovery but I suspect you'll get similar to testdisk.

ConnM 08-04-2017 08:43 AM

Ok which option in TestDisk will recover the partition table, do I have to analyse It first?

sundialsvcs 08-04-2017 08:45 AM

If fsck removed them, then, I am sorry to tell you, they were already gone. :(

scasey 08-04-2017 11:05 AM

Off-topic, but...
 
Quote:

Originally Posted by AwesomeMachine (Post 5744121)
Code:

$ file * > type.txt
will give you all the file types. You can sort that by type with
Code:

$ sort -k 2,2 type.txt > type1.txt
You'll need to make the two text files with touch.

In my experience, redirection to a non-existent file will create the file. Why do you say they need to be "[made] with touch"?

Just wanting to understand...

Thanks!

ConnM 08-04-2017 11:41 AM

Could I manually fix the partition table with fdisk?

ConnM 08-04-2017 12:07 PM

Quote:

Originally Posted by sundialsvcs (Post 5744364)
If fsck removed them, then, I am sorry to tell you, they were already gone. :(

They are not gone, and I am not quite sure what removed them, because photorec was able to recover the files, but it will take eternity to sort through the vary similar file types.
I do think fsck did do something to it though.

sundialsvcs 08-04-2017 12:47 PM

What I meant to say was, the directory structure was gone.

You might find the notion of lost+found worth trolling through ... I don't.

syg00 08-04-2017 06:07 PM

fsck ensures the integrity of the filesystem - not necessarily the files within.

Recreating the partition table does no damage to your data that may still be there, but anything after that (creating a filesystem, adding files) will almost certainly lead to over-writing of (at least) some of the residual data.
At some point you will have to accept that the data on the corrupt disk, is lost.

ConnM 08-05-2017 10:40 AM

I have found a very interesting thing that happened with gparted when I tried to resize the partition, take a look in the screenshot.
Screenshot: http://imgur.com/a/y6ipr


All times are GMT -5. The time now is 01:06 PM.