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
andcat
on one of the affected files, and this is what I getroot@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.pngroot@PartedMagic:/mnt/local/Users# cat ianco/AppData/Local/Android/sdk/docs/images/android-5.0/notifications/expandedtext_combo.pngcat: ianco/AppData/Local/Android/sdk/docs/images/android-5.0/notifications/expandedtext_combo.png: No such file or directory
Solution:
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 ofchkdsk
. 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
orddrescue
), then connect the clone to working Windows, fix the filesystem and get to your files.