cp to copy only non-corrupt files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cp to copy only non-corrupt files
# 15  
Old 12-28-2011
Thanks a bunch, this is the kind of think I hate to try to navigate through on my own. Smilie

Since the file system on my new drive has issues after the dd, it seems I should do something like the following.

1. Try a repair tool (fsck, chkdsk)
2. If that doesn't work, reformat the new drive and copy data from my external backup back on to the new drive.
(the data that made it onto my external drive should be fine since cp can't copy a file system error)

Since this is an ntfs partition, should I try chkdsk in windows first, or can I try fsck from Ubuntu, or does it matter?

LMHmedchem
# 16  
Old 12-28-2011
Quote:
Originally Posted by LMHmedchem
2. If that doesn't work, reformat the new drive and copy data from my external backup back on to the new drive.
(the data that made it onto my external drive should be fine since cp can't copy a file system error)
I think you misunderstand slightly.

It's possible for a file that copied fine to have a chunk full of nulls in the middle of it because of the errxfer. That won't turn it into a mysterious undeleteable file. It'll be an ordinary file that doesn't misbehave with cp, but its contents could be other than what you were expecting.

These undeleteable files had corruption in the filesystem itself.

Since there were only 12 kilobytes of bad sectors -- which were as likely to happen in empty space as inside a file unless the drive was over 50% full -- the odds of this happening are hopefully low.
Quote:
Since this is an ntfs partition, should I try chkdsk in windows first, or can I try fsck from Ubuntu, or does it matter?
For block copies the contents don't matter, but if you want to actually check the filesystem contents, use windows tools to check windows filesystems.
# 17  
Old 12-29-2011
Well I'm getting closer. After the cp to the external drive finished, there was only one IO error noted. I do get the fact that there could be other files with some 0s instead of whatever used to be there. I was just commenting that the IO error from cp was from a problem with the file system on the src drive and not the file that was being copied. Also that I shouldn't expect corruption of the filesystem on the external drive resulting from the cp.

I booted windows on the new computer and chkdsk ran and finished this time, so it looks like the new drive is good to go, plus I have the data on another external.

...then I put the new drive back into the original box and tried to boot windows. I got to the windows xp screen and the progress bar was slowly lurching across (which I have never seen) and it never did get past that point. I had used that computer several times that day (without the data drive), so that was odd. I decided to unplug all the drives except the ssd with windows. I forgot the grub2 was installed on one of the other hdd MBRs, so I got a device not found error from grub2.

I have not been able to get grub working yet. I tried to get the hdd with grub2 back into the sata port it was in, but I didn't have any luck with that. I ended up mounting all of my drive in the sata pci card and booting with a supergrub2 disk. I did, search for grub2 installations, and then loaded the file it found. I was able to boot into both windows and ubuntu doing this. I did update-grub in ubuntu, and it found all the OSs, but I still don't get the grub menu on boot without using the supergrub2 cd.

I'm not sure if I need to uninstall and re-install grub, or if grub has a problem when the drive is on a pci controller, or what.

I realize this has gone well beyond my original question about a cp script, so if anyone thinks I should move this conversation to a different forum, just let me know.

LMHmedchem

---------- Post updated at 02:40 PM ---------- Previous update was at 12:02 PM ----------

I was able to use boot-repair from a CD,
https://help.ubuntu.com/community/Boot-Repair

and this got my grub menu back by re-installing. I am not getting check disk running on restarts, so it looks like everything is resolved for now. I am running everything off the sata pci card, so I'm still not sure if my motherboard sata controller is dead or not.

LMHmedchem
# 18  
Old 12-31-2011
That there were actual bad sectors on the drive kind of points to the drive controller not being the defective part...

Windows may need to be reinstalled if data was corrupted. How else can you know you have a (relatively) dependable system?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question