WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Q] Oh noes, my USB flash drive died! How to recover?  (Read 15784 times)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
[Q] Oh noes, my USB flash drive died! How to recover?
« on: September 03, 2013, 02:31:59 PM »
I'm upset because I fear to loose all my settings, scripts, modifications I did to TinyCore and GRUB2.

I always boot TC from my USB flash drive (much quicker than my HDD) and didn't have made backups to an alternate storage device (bummer).
Yesterday USB boot failed 2 or 3 times - but was working again without a glitch after powering off my PC. It boots natively from USB via BIOS.

Now, the OSes I have installed on HDD do not recognize any filesystem on it.

GParted shows the hole drive as 'unallocated' space - and is unable to repair the partition table (Attempt Data Rescue...).

fdisk also can't see a valid partition table and shows only 'unallocated' space (option v).


Please, does anyone have an idea hot to recover the data? I really do not want to format.


I am (was) using an USB flash drive (Kingston DataTraveler G3 - 4GB) to boot several Linuxes via GRUB2 (v2.00).
Partitions:
3BG FAT32
  (data + .ISOs)
~700MB EXT2
  (BOOT + GRUB2 + TinyCore)

I recently added making use of the env_var feature to grub.cfg (for booting lastly selected OS).
At the very last succsessful boot, I saw a message after loading TinyCore's initrd (my grub.cfg echo'es that) about an bad env_var entry or something similar (I also played with unicode characters in menu titles).
Though, everything booted and worked fine - until reboot (without saving the session).


Thanks in advance.
Download a copy and keep it handy: Core book ;)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #1 on: September 03, 2013, 03:07:53 PM »
You can try re-creating the fdisk partitions to be exactly like they were before.
Then try accessing the filesytsems.
The problem with flash drives is that when they die, they are generally completely unrecoverable.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #2 on: September 03, 2013, 03:20:00 PM »
So I have to know/guess the correct partitioning.. Is there any tool that can lead me a hand there?
The problem is I moved and merged partitions when I ran out of space.

The result was that xfe in TinyCore always showed me this:
/mnt/sdb (not mountable/usable)
/mnt/sdb1 (ext2)
/mnt/sdb3 (fat32)

So I have no idea where the first partition (the important one for me) would start.
Download a copy and keep it handy: Core book ;)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #3 on: September 03, 2013, 04:52:11 PM »
You might try the testdisk app.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #4 on: September 03, 2013, 05:59:16 PM »
Try to dd the whole drive to a file on a regular hard drive, then attach it to a loop device. Then try data recovery from there. But then a boot drive shouldn't have much data in the first place. That's why you're keeping the drives separate, right?

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #5 on: September 03, 2013, 06:54:18 PM »
Thanks gerald_clark
I have installed testdisk and it is indeed able to at least find something. So I know now that my USB drive is not entirely fried. I think only the partitioning got messed up for some reason. Maybe I shouln't let grub write to my drives in the future (or I should use a propper partitioning for that matter)?

Thanks andyj for your suggestion
Unfortunately I do not have enough space left on my HDD to dd my USB drive there.
I have initially partitioned it that way to be able to still use it under windows (which didn't work btw since windows only wants to read the first partition..)


So, now the situation is as follows (not copy/pasted):
 TestDisk -> Analyse
  Disk /dev/sdb - 4003 MB / 3817 MiB - CHS 1017 124 62
   Current partition structure:
    ~~ nothing listed ~~
    Partition sector doesn't have the endmark 0xAA55
    >[Quick Search]
    Warning: the current number of heads per cylinder is 124
    but the correct value may be 255.
    [Continue]
     ~~ "FAT16" (sdb; not sdb3) ~~
     ~~ "Linux" (sdb1) ~~
     >[Deeper Search]
      ~~ "FAT16" (sdb; 343 MB oh so big? - seems to contain only unreadable garbage but thats not new) ~~
      ~~ "Linux" (sdb1; 781MB hmm might be correct - a little bit gabage - nothing else) ~~
      ~~ "Linux" (sdb1; 781MB - no file found) ~~
      ~~ "FAT32" (sdb3; 3220MB - I can browse files) ~~
 
The ext2 partition (sdb1) is not accessible. testdisk sees it as two paritions which are overlapping each other. I tryed changing heads from 124 to 255 via options but same result.
« Last Edit: September 03, 2013, 06:56:26 PM by Misalf »
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #6 on: September 05, 2013, 09:55:34 PM »
Does anyone know some magic CHS values I could try to use or what values might possibly be the correct ones?
Download a copy and keep it handy: Core book ;)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #7 on: September 05, 2013, 10:29:33 PM »
Hi Misalf
I don't think you should be changing the CHS values.
Quote
    Warning: the current number of heads per cylinder is 124
    but the correct value may be 255.
255 may be a common setting for the number of heads but it's not a requirement. If you change it to 255 you are telling
it your drive is a little over 8Gbytes in size.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #8 on: September 06, 2013, 01:29:45 AM »
Oh, thanks for that info.

Is my data lost if TestDisk can't recreate the partition or at least copy files?
Download a copy and keep it handy: Core book ;)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #9 on: September 06, 2013, 01:49:43 AM »
Hi Misalf
Quote
Is my data lost if TestDisk can't recreate the partition or at least copy files?
I don't know. What does the command:
Code: [Select]
fdisk -lreport for the drive? Use your left mouse button to highlight the results in the terminal. This copies the text into the paste
buffer. Then use the center mouse button to paste into the browser.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #10 on: September 06, 2013, 02:05:46 AM »
fdisk and gparted were not able to see anything on that drive (unallocated space).

I was able to recreate my FAT32 (second) partition using TestDisk so this one is now listed in fdisk as sdb1 (originally sdb3).

My linux machine is another PC where I do not have configured a dialup network so I can't copy/paste right now but I could do so later. Any useful info I could post from fdisk output apart from partitioning layout?
Download a copy and keep it handy: Core book ;)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #11 on: September 06, 2013, 02:33:42 AM »
Hi Misalf
Quote
fdisk and gparted were not able to see anything on that drive (unallocated space).
Then it sounds like the partition table is messed up. You might want to ask Google for information on how to attempt
to fix it, though I don't think it will be easy.


Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #12 on: September 06, 2013, 02:39:33 AM »
Test disk is the  only of tool I know which can rewrite the partition structure whilst leaving the contents intact.

It has saved my bacon many a time.



Sent from my iPad using Tapatalk HD

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #13 on: September 06, 2013, 03:10:56 AM »
Hi Misalf
This tutorial may be of some help:
http://www.dedoimedo.com/computers/linux-data-recovery.html

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: [Q] Oh noes, my USB flash drive died! How to recover?
« Reply #14 on: September 06, 2013, 09:23:06 PM »
Rich, that's a good tutorial and honest too.  I mean, test disk is a great tool but it is only magic when given something it can handle.  Sometimes we are doomed before we attempt any recovery.
They have good info at the developers web site also.


definitely agree not wise to be changing geometry values.


Sent from my iPad using Tapatalk HD