Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
I'm in panic mode right now. A week or so ago, I tried to access my USB drive by way of Mandrive 2007. I'm pretty new to this, so bear with me. I had trouble with the permissions. I tried to write to the drive with some new pictures and it wouldn't let me. I tried to change the permissions of all the folders on the drive and it just wouldn't work. I gave up and came back to the problem just now. The folders are all there, but the files are gone! This is multiple GB of all my stuff and it was in transition between locations, in other words, this was my only copy. My fiance's stuff was there too. Windows doesn't see the files either.
One more thing: Windows says that the drive is half full (about what I would expect if the files were there). I feel like I just need to reestablish access to them or something.
Sorry to hear about your problems. I hope we can help you. I'm not an expert in data recovery though, so I can only give you some general pointers.
First of all, I don't know exactly what happened to you, but part of the problem is that the FAT format (which nearly all flashdrives are) does not natively support the *nix permissions system. The permissions you see are simulated through a mount option (umask) and aren't changeable with the usual chmod command. Somehow you must have corrupted your filesystem in the attempt, something that's not difficult to do with FAT. A search of the forums or google can give you info on how to handle permissions on fat drives.
Anyway, before you do anything else, do NOT mount the drive with read-write permissions (If you don't know how to manually mount drives, learn that first). In fact, you should instead use the dd command to copy an image of it onto your hard disk and work from that to recover your data. Something like: "dd if=/dev/sda1 of=/backuplocation/usbdiskimage.iso bs=512" should do (not sure if the byte count is good though. Can anyone else help me there?). This image can be generally be treated as if it were a drive device, or mounted via a loopback device.
Your first recovery option should probably be dosfsck. This tool can sometimes recover corrupted partition tables, which is likely your problem. I've managed to salvage a bad usb stick myself using it.
If that fails, you can try to recover the files individually. There are several data recovery tools out there, but the one that worked best for me is photorec, which despite the name can rescue a large number of other file types as well. It comes in a package called testdisk. There's another promising one I've found called magicrescue, but I don't have experience with that yet. Perhaps someone else can point out other good tools you could try.
I'm not going to go into details on how to use these tools; you can read the man pages yourself. Just be sure to run the recovery tool on the disk image instead of the drive itself. The worst thing is you'll probably loose all the file names and have to rename all the files manually. But at least you'll have them.
Your partition table isn't hosed, your file allocation table (FAT - get it?) is hosed. Writing to the drive has probably caused you to experience some data loss.
Stop writing to the drive, period. The instructions you were given for recovery were good ones; the 512 block size should be fine. Image the drive to someplace on a Linux HD, then mount the image and work on that.
In the worst case, after you have an image that you know is faithful, mount the drive on a windows machine and run scandisk or chkdsk (as appropriate, depending on the version of windows).
My advice, always make a backup copy of data you never want to lose. Don't ever think that the hard drive or whatever won't fail on you on that given day, because it could happen at any given day or time..
Thank you all. I am going on vacation tomorrow, so I will not be able to start on your suggestions right away (nor will I be able to sleep well at night with this all messed up), however, it will be high priority for me when I get back. I will repost with more questions and results when I have them.
FAT is usually easy to recover. You'll get the files back, most likely. You won't get a lot of the file names back and if they are images you'll have to browse all these images with funky names like chk0001 and see what they are, then name them.