On 2015-06-29 00:39, Chris Bennett wrote: > I had 4 different hardrives that were failing. > I bought a 2TB usb drive to back up all the home folders. > I now would like to cp all of the folders and files to another empty > partition. > But I don't want to overwrite any files with same name but different > content. > For example: > > /homeX/index.html to /homePerfect > /homeY/index.html to /homePerfect > > both have same name but different contents. > > I googled but couldn't find any solutions. > Ideally I would like a list of failed file copies. > > Any ideas or scripts or ports? > Browsing through 4 home folders is a nightmare.
Definitely listen to Philip Guenther's advice. Get as much data off the drives as you can first! That is your number one priority. Make a directory on your new drive for each of the old and just throw the contents in there: # mount -o ro /dev/old0 /mnt # <- ALWAYS mount failing disks read-only! # mkdir /2TB/disk1 # One destination dir per disk! If you have rsync installed, use that: # time rsync -aHv /mnt/ /2TB/disk1 2>/dev/rsyncerr.log I often "time" longer runs. That way if I leave the computer, when I come back it gives me a quick indication of whether the command ran right or not. If a job that's expected to take several hours ends in a few seconds, then something's clearly gone wrong. Also, capture stderr to a log file. You want to see which files, if any, fails to copy due to disk error. You probably also want to glance periodically at /var/log/messages for signs of disk read errors. Maybe "tail -f" it in another window. If you don't have rsync, use cpio (cp -R doesn't preserve hard links): # cd /mnt # find . -print | cpio -pdmv /2TB/disk1 2>/tmp/cpioerr.log # if [ $? -ne 0 ] # then > echo "At least one error occured, check /tmp/cpioerr.log!" > fi # cd; umount /mnt # <-- cd away from the disk or umount fails If you do use cpio/tar/pax, pay attention to max file sizes. If you have files larger than 4/8 GB (depending on archive format), you're shit out of luck and needs to install something like rsync. And, last but not least, don't forget to copy ALL partitions on each drive, if there are more than one. :-) Rinse, lather, repeat until all disks are processed. Then you can also use rsync to help you merge the contents to a common directory, but as I write this I noticed that someone else just commented with a nice instruction about that. :-) More tips: * Move the failing disks as little and as carefully as humanly possible. * If they are in a USB enclosure, I recommend removing that and plugging them directly into a SATA port in your computer, if possible. Three reasons: safer error reporting (I think), faster transfer and different controller/power supply, in case either of those are what is really failing. * Always lay disks flat on their "belly". Standing up on their long edge is okay too (just don't tip them over!), but never ever run a spinning hard drive upside down. * Make sure they have good cooling. If you run failing disks hot they will most likely fail faster and harder. In extreme cases I've even had success reading "unreadable" disks by running them in a freezer. The tiny amount of expansion/contraction of the drive heads and platters due to heat/cold just maaay be enough to make a difference. But probably not, so do this as a last-ditch effort. * Related to the previous item, if you plug in a failing disk that is cold, let it run for a few minutes before attempting to read from it. By letting the drive reach its normal working temperature you give its read heads the best chance possible to align themselves to what's already written on the platters. * If everything else fails, and you really need to rescue something from a bad drive, try this software: https://www.grc.com/ I know I know, the web site looks like a joke, a relic left over from the 90's (and it probably is), but the software, SpinRite, really can wring every last possible bit out of a bad sector. It's $89, but well worth the money to save the family photos... * If the file system structure is damaged and you need to run fsck before reading from the drive, DON'T. Instead, make an image copy (using dd for example) to another drive of at least the same size, and then run it from there. If the copy produces read errors, you might want to zero out those blocks on the destination before trying an fsck. * When you are absolutely certain you can't get more off of your drives, DON'T KEEP THEM AROUND. Throw them out! In a year's time, you will have forgotten that they are full of errors, and try to reuse them again... :-) Good luck. Regards, /Benny -- internetlabbet.se / work: +46 8 551 124 80 / "Words must Benny Lofgren / mobile: +46 70 718 11 90 / be weighed, / fax: +46 8 551 124 89 / not counted." / email: benny -at- internetlabbet.se