1

I am trying to copy files to my external hard drive using PartedMagic. My computer won't boot, so we are sending it in to get repaired. I've tried EVERYTHING but can't get it to boot into any desktop or recovery environment. What I am able to do is boot to a PartedMagic command line (Using Ultimate Bot CD). That is why I am just copying files instead. Both drives are NTFS. I'm using PartedMagic, which has NTFS support built in.

My issue is that the cp command is skipping random files. This is what the command looks like:

root@PartedMagic:/mnt/local/Users# cp -R ianco/* /mnt/usb/ianco-bak/

The error I'm getting is:

cp: cannot open <filename> for reading: No such file or directory

After getting this issue, I executed this command again, but with the -n (do not overwrite) parameter, and noticed that it skipped the exact same files. I created a log of the skipped files here.

Why is it skipping these specific files, and more importantly, how do I make it copy everything?

EDIT 1: I ran ll and cat on one of the affected files, and this is what I get

root@PartedMagic:/mnt/local/Users# ll ianco/AppData/Local/Android/sdk/docs/images/android-5.0/notifications/expandedtext_combo.png
-rwxrwxrwx    2 root     root             0 Apr 25  2016 ianco/AppData/Local/Android/sdk/docs/images/android-5.0/notifications/expandedtext_combo.png

root@PartedMagic:/mnt/local/Users# cat ianco/AppData/Local/Android/sdk/docs/images/android-5.0/notifications/expandedtext_combo.png
cat: ianco/AppData/Local/Android/sdk/docs/images/android-5.0/notifications/expandedtext_combo.png: No such file or directory
  • You've said: "I created a log of the skipped files here:", where is 'here'? – wb9688 Nov 6 '16 at 6:59
  • 2
    If it always skips the same files, that's not "skipping random files", that's probably an issue with those files... – chthonicdaemon Nov 6 '16 at 7:09
  • Have you checked if any of these files actually exist and are readable, i.e. by doing a cat on them? What does ll for any of them show? Maybe they are dead symlinks? – dirkt Nov 6 '16 at 8:25
  • 1
    Or they are damaged files ... – DavidPostill Nov 6 '16 at 12:23
  • 1
    How exactly did your system enter "unable to boot" state? It looks to me the filesystem corruption may be involved. Have you tried connecting the drive to working Windows so it can run chkdsk on it? (I believe Linux cannot repair NTFS). The ll output you provided reports size 0, I think it also may indicate damaged file or filesystem. Check sizes of other problematic files. – Kamil Maciorowski Nov 6 '16 at 21:37
1

I'm writing this after the OP repaired the filesystem with chkdsk. This answer gathers useful information from comments to give some insight to future users with similar problems.

The ll output reports size 0 for the file that should have some data in it. This, as well as the encountered error, indicates damaged file or filesystem.

Linux is not well equipped to fix corrupted NTFS. There is ntfsfix tool, however its manual says:

ntfsfix is a utility that fixes some common NTFS problems. ntfsfix is NOT a Linux version of chkdsk. It only repairs some fundamental NTFS inconsistencies, resets the NTFS journal file and schedules an NTFS consistency check for the first boot into Windows.

As you can see the tool leaves the hard work for Windows to do. It seems there is no way to repair serious NTFS issues from under Linux only.

The right tool is Windows chkdsk with /f option. To use it you can either:

  • boot to some Windows repair disk which provides chkdsk;
  • or connect the drive to working Windows machine and run chkdsk from there;
  • or (cumbersome way, still it may be useful if you cannot remove the drive nor boot to repair disk) clone the drive to another one (with dd or ddrescue), then connect the clone to working Windows, fix the filesystem and get to your files.
0

I figured it out (with the help of everyone in the comments, of course). The reason I was doing this is because I couldn't boot to UEFI, which was what the Windows 10 repair disk was configured for. I was, however, able to boot to a windows 7 repair disk.

Once I booted to the Windows 7 repair disk, I ran chkdsk C: /f and after it finished (which was over 24 hours, by the way) I was able to copy over the (no longer) corrupted files to my hard drive. I hope this helps anyone else who may be experiencing the same issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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