A while back, I found that a trusted 1 GB USB drive was exhibiting apparent corruption. Some of the directories gave listings in which the file names were garbled. Fortunately the corrupted files in these directories weren't mission critical. However, I became concerned that valuable files that were on the root of USB drive might disappear too. I was on the road - so my back up options were limited. However, the following commands rapidly salvaged, compressed, encrypted, and stored on gmail what was left on my drive. These commands might be useful to you, if you find yourself in similar circumstances. And, if you know what causes USB directory listing corruption, and how to avoid it, and/or recover from it, please let me know!
# Commands to extract data from a USB drive and copy to gmail for storage # Firstly, copy what you can from your USB drive to a directory # called (in this case) 'save' mkdir save cd save cp -r e:/stuff . # create a tar file of that saved directory cd .. tar -cvzf save.tgz save # encrypt the tgz file ccrypt -e < save.tgz > save.tgz.backup # split the tgz file into ~ 10 MB chunks split -b10000000 save.tgz.backup # now mail the chunks to your gmail account for file in x* do echo $file echo $file | mutt -a $file -s $file youremailaddress@gmail.com done
And to reassemble the original files you proceed as follows:
# download the gmail attachments, then cat x* > temp.tgz.backup # then decrypt them with: ccrypt -d < temp.tgz.backup > temp.tgz # and finally un-tar the data tar xvof ./temp.tgz