Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Been a long time since I got very far under the hood in Unix so I'm probably not even using proper terminology when I say 'registry,' but here's the situation.

I have a disk thats dying. Lots of i/o errors. So I'm in the process of copying all of the files from that disk over to another.

But there are definitely files that aren't making it over. Is there a way that I can look at the 'registry' of files on the bad disk and compare that with the files that exist on the new disk and determine which ones are missing?

I know I could try and do a diff between the two filesystems but am concerned that reading through every file on the bad disk is just going to error out - whereas I'm hoping that the list of what files exist on the bad disk is still sitting on undamaged sectors.

Or does Unix (actually this is all OSX, not pure Unix) not even contain a global registry file?

share|improve this question
1  
Why don't you just do a diff of the output from find /onefilesystem with the output from find /theotherfilesystem? –  Celada Jan 25 '13 at 19:36
add comment

5 Answers

If the disk is damaged, it might be smarter to copy the whole disk (or each partition on its own) to files. When disks start failing they usually are completely gone soon after. Then you can loopback mount the copies, and go wild with your preferred forensic tools to try and salvage whatever you can.

share|improve this answer
add comment

On UNIX conforming to FHS, system-wide configuration is usually stored in /etc (som epieces may reside in /usr/local/etc or /opt/app/etc) and user configuration is stored in home directories, almost always in files and directories beginning with a dot (.vim/, .libreoffice, ...). There is no single settings database, if by single you understand single file. Some large pieces of software may store all or most of their configuration in a single file, but the whole system not. Hence you need to copy the above files, to restore the settings, which is also why it usually is a good idea to backup them from time to time alongside "regular" data (or even keep them under a version control system).

That said, once you save the most important stuff, I would strongly suggest using GNU ddrescue to get as good copy of the filesystem(s) as possible and working on those copies. Since ddrescue can work on levels below the filesystem, it is often able to recover more data (and also more quickly) than just copying.

share|improve this answer
add comment

There is no “registry” containing a list of file names on the system (this is not a common thing). The list of file names in each directory is stored in that directory. You can generate a list of all file names on the system with the find command.

find / -xdev | sort >/tmp/file-list

This creates a sorted list of file names in /tmp/file-list. The -xdev option tells find not to descend into other mounted filesystems such as operating system special filesystems or removable drives.

It would probably be more useful to know which files are identical, as well. I recommend copying your files with rsync and saving the error output from rsync in a file, then analyzing that file to see what made it over and what didn't.

share|improve this answer
add comment

This is what you're looking for:

Beyond Compare

share|improve this answer
add comment

I would use rsync. It will intelligently compare files during the copy process, and give you a list of the ones that couldn't be copied afterwards.

rsync -av /path/to/source /path/to/target

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.