Sponsored Content
Top Forums Shell Programming and Scripting cp to copy only non-corrupt files Post 302583852 by LMHmedchem on Wednesday 21st of December 2011 12:24:02 PM
Old 12-21-2011
Quote:
Originally Posted by Corona688
Ordinary files don't start malfunctioning just because you're copying them from a dying drive. Their contents may be suspect, but they're not magic; their badness doesn't leak into the filesystem at large. Bad files don't have the power to corrupt good filesystems when copied.
That is more or less what I thought, but since the drive seemed to work alright until I transferred allot of data, I wasn't so sure. In the last effort, I did a low level format, and then copied about 1GB of data onto the drive. Then I restarted and check disk ran. It found some errors, fixed them, and then finished. On subsequent restarts, check disk didn't run, so I thought I was in the clear. I was able to open files and use apps in the data I had copied. Then I copied about 50GB more data and restarted. The same check disk cycle started, but this time it wouldn't finish. After restart, some of the original 1GB of data was corrupted and those apps would fail to run. There are many variables here, so the logical thing to do would be to try to insure that the fault was not in the data being moved. The problem is that the data is on a drive with bad sectors, but it works in the main. Check disk does not run on every start up when that drive is in the machine, which it should if the source file system is really borked.

Quote:
Originally Posted by Corona688
This means, I suspect, you've got bigger problems than a dying drive. Your system itself may be corrupting data somewhere along the line.
This is a problem that is proving difficult to diagnose. There are two other platter drives and an SSD in this box and they are not acting up at all. This leads me to believe that the new drive is just bad. The fact that the drive passes WDs diagnostic software makes that a bit less clear. Memory, the motherboard sata controller, sata cables, power supply, operating system, etc, are all other places where the problem could reside. In most of those cases, I would expect the problem to be more wide spread. I moved the drive off of the motherboard sata controller and onto a brand new PCI sata card in case the controller was going.

Quote:
Originally Posted by Corona688
My approach to rescuing this would be to remove both drives and install them into a scratch computer. Doesn't have to be a good computer, as long as it can boot a rescue CD of some sort. Then block-copy the old drive onto the new one, raw. This will overwrite all current contents, and it must be equal or greater size. Use dd_rescue if you have it, dd conv=noerror,sync if you don't.
Is this something that I could do in windows cygwin, or would a flavor of linux be better. I have Cent and Ubuntu on one computer here. I have some live linux CDs, but the computers I could use those on are number crunching servers that don't have space for hard drives. Another issue is that once I have moved data onto these drives, when I delete the partition, I can't create a new one with a quick format. After this blew up again last night, I deleted the partition on the drive. When I replaced it, windows couldn't format the new partition. The format failed. This happened before and I had to do a low level format to get it back. That takes about 6 hours, so it's not a trivial step.

Quote:
Originally Posted by Corona688
Only then, once your data isn't in danger of flopping over and dying the more you touch it, should you start playing around with it.

How's it supposed to tell "good" files from "bad" ones, by the way?
Yea, I'm not sure. I know that I get OS messages about corrupt files from time to time. I guess you could try to open the file with the default app and that would trigger some exceptions if the file is bad. I guess you could try chown or chmod, I have got some error messages about this not working on files when they may be bad. Anything like that would take forever.

At this point, I am inclined to RMA the drive (I have an open ticket on it) and do the dd_rescue copy with the new drive. What do you think about that?

LMHmedchem
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

corrupt or lost data

Thank you livin Free for all your help. We removed a lot of spool files and report files. Which should have freed up some space. But now I think a major problem we have is we have lost or corrupt files which are preventing us from coming up correctly. Can we load or can you copy us a directory... (1 Reply)
Discussion started by: NOT A CLUE
1 Replies

2. UNIX for Dummies Questions & Answers

I got a corrupt /etc/inittab file....what next?

Hi guys, For some reason a client has given us a Sun Netra T1 with Solaris 8 to administer for them. That's always good business. However, the other day we rebooted the machine and to our amazement, after doing the preliminary hardware tests, we got an error messgae saying that /etc/inittab was... (3 Replies)
Discussion started by: Ivo
3 Replies

3. HP-UX

Corrupt Member File

I have been fine adding/removing printers up until this week. Now when I go to add a new remote printer I get "corrupted member file". I go to /etc/lp/member and the byte count on the new printer name is 0. I VI the file and put /dev/null in to make it the correct size and it all looks fine and... (2 Replies)
Discussion started by: astout
2 Replies

4. Solaris

How to corrupt a superblock?

I need to corrupt a superblock of a mounted device in a soalris m/c and check recovery from an alternate superblock. How can this be done? (2 Replies)
Discussion started by: sujathan
2 Replies

5. Solaris

How to safely copy full filesystems with large files (10Gb files)

Hello everyone. Need some help copying a filesystem. The situation is this: I have an oracle DB mounted on /u01 and need to copy it to /u02. /u01 is 500 Gb and /u02 is 300 Gb. The size used on /u01 is 187 Gb. This is running on solaris 9 and both filesystems are UFS. I have tried to do it using:... (14 Replies)
Discussion started by: dragonov7
14 Replies

6. Shell Programming and Scripting

how to copy files followed by list of names of all the files in /etc?

....... (2 Replies)
Discussion started by: pcbuilder
2 Replies

7. HP-UX

corrupt disk

Hallo Friends, I have application X running on hpux 11.11 and oracle 9i release 2. I recently had a hardware failure on disk /dev/dsk/c2t0d0 Below is the systemlog file : root@a7dmc:/var/adm/syslog > /opt/resmon/bin/resdata -R 155713541 -r /storage/events/enclosures/gazemon/0_1_1_0.0.0... (11 Replies)
Discussion started by: kekanap
11 Replies

8. Red Hat

Unable to copy files due to many files in directory

I have directory that has some billion file inside , i tried copy some files for specific date but it's always did not respond for long time and did not give any result.. i tried everything with find command and also with xargs.. even this command find . -mtime -2 -print | xargs ls -d did not... (2 Replies)
Discussion started by: before4
2 Replies

9. Solaris

Solaris 10 GIF files corrupt during unzip

Problem occurs on one Solaris build. Every time we unzip the Jan CPU, there are several patches that error out (appears to be related to the GIF files). When we unzip the CPU on another Solaris build to a network storage area, we can execute without issue on the original machine. Any ideas? ... (1 Reply)
Discussion started by: grahamr72
1 Replies

10. UNIX for Dummies Questions & Answers

Copy files from one drive to another, keeping most recently modified files

Hi all, I am a bit of a beginner with shell scripting.. What I want to do is merge two drives, for example moving all data from X to Y. If a file in X doesn't exist in Y, it will be moved there. If a file in X also exists in Y, the most recently modified file will be moved to (or kept) in... (5 Replies)
Discussion started by: apocolapse
5 Replies
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy