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
Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
NullBite
  • 73
  • 2
  • 8
  • You've said: "I created a log of the skipped files here:", where is 'here'? – wb9688 Nov 06 '16 at 06: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 06 '16 at 07: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 06 '16 at 08:25
  • 1
    Or they are damaged files ... – DavidPostill Nov 06 '16 at 12:23
  • @wb9688 Sorry, I accidentally clicked publish without having the log ready... I changed 'here' to a link. – NullBite Nov 06 '16 at 19:32
  • @dirkt okay, I ran `ll` and `cat`. read EDIT 1. I'm sure they're not dead symlinks. – NullBite Nov 06 '16 at 20:37
  • 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 06 '16 at 21:37
  • @KamilMaciorowski I was using my computer and it gave me a bunch of memory errors, so I rebooted it, and it wouldn't boot anymore. I can't remove the drive or boot to a windows repair disk, so `chkdsk` is not an option. When I used `ll` on some other files, they also reported size `0`. I used `ntfsfix /dev/sda3` but it didn't do anything... – NullBite Nov 07 '16 at 00:58
  • @iancoguz The `ntfsfix` manual says it "is NOT a Linux version of `chkdsk`". If you really want to save these files and cannot remove the drive, clone the drive to another hard disk (well, cloning the sole partition will be enough but you have to build the new partition table properly to make it work). The cloning must be done on block level (like with `dd` or `ddrescue`), not on filesystem level. Then connect this another disk to working Windows and let it run `chkdsk` on it. This may or may not help though, depending on how far the corruption went. – Kamil Maciorowski Nov 07 '16 at 15:47
  • @KamilMaciorowski I do not have another hard drive, and I don't have enough space on my main drive to do this. Do you think a Windows 7 repair disk with `chkdsk` would work? – NullBite Nov 07 '16 at 20:53
  • @iancoguz I guess it may work. This seems to me as a sane thing to do unless your drive (hardware) is faulty. The general safe way of dealing with any disk or filesystem problem is to make a clone and to work with its copies (yet often it is an overkill). Since you have no means to do so, in my opinion your best option is to `chkdsk` somehow and see what happens. – Kamil Maciorowski Nov 07 '16 at 21:17
  • @KamilMaciorowski Thank you, this actually worked (to the point where i can get to the recovery screen on my internal hard drive). I created the Windows 7 boot CD, and ran `chkdsk` on my internal drive. it took over 24 hours on `replacing invalid security id with default security id for file *` (It did this for every file), but after it finished, I was able to copy the missing files. Now, I can boot to the recovery media, but i cant refresh or reset, so i will open a new thread. I will post the link after creating it. Sorry for the delayed response, I had too much going on to respond. – NullBite Nov 11 '16 at 03:08

2 Answers2

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.
Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
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.

NullBite
  • 73
  • 2
  • 8