Calling all OS X experts.
I copied two 1Tb drives (ex-Windows) onto a new 2Tb USB 3.0 drive using Finder on the Mac (OS X 10.9). The 2Tb drive is now about 90% full.
I now want to duplicate that 2Tb drive to another 2Tb drive using the Mac, however it keeps claiming about 40% of the files are busy. None of the files on the 2Tb drive have ever been opened in any app, other than this attempt to copy the files across.
I tried copying 2Tb to 2Tb using finder, which once it found 1 file busy just stopped copying altogether. Not particularly useful. I tried using the icons view, the list and columns views.
I then switched to Terminal using cp -RXvn and later just -cp RXn. Both were able to copy about 60% of the files.
I've tried unmounting both drives, rebooting and reformatting the 2nd drive. I've tried all three before attempting again and I get to about 1.34 Tb each time. I've tried several times and I'm noting it's not always the same files having the issue, although it's hard to tell when there's thousands of files.
What I get looks like this:
cp -RXn "/Volumes/USBdrive 1/" "/Volumes/USBdrive 2"
cp: /Volumes/USBdrive 1/My photos/USA trip/image 1472.png: Resource busy
cp: /Volumes/USBdrive 1/My photos/USA trip/image 1483.png: Resource busy
cp: /Volumes/USBdrive 1/Our holiday/Rome/tour map 2014.pdf: Resource busy
I'm new-ish to OS X, so I don't understand how the file has become in a busy state, or what to do about it. It doesn't make much sense to me to not copy the file even if it's in use anyway (Windows would).
Can anyone suggest how to get around this and get all the files from one drive to the other? Do I need to find a way to stop the resource from being considered Busy first, and if so, how?
Best Answer
Try this from terminal:
Now do:
This command will show you all of the open files on that volume. You will see the application name of the application that is holding onto the file. Lets say for argument's sake that it is
Finder
.Now type in (Just make sure you have closed out of all of your applications first to be on the safe side):
Now run the
lsof
command again and you should no longer see those files. Now you should be able to copy them.Hope that does the trick.
In
Terminal
type inenv
.Look at where it says
USER=
and copy that name exactly.Now we will change the owner of all of the files on the drive, just make sure you are mounted to the drive you want to copy and not your system drive. Mount the root directory of the drive you want to copy and type:
For where it says
[owner]
, enter, enter the user name from above. You will be prompted for your password because we addedsudo
which is Super User do.If it exits with a status of
0
, then there were no errors. If you are getting an exit code > than0
, then you can drop the f and you will see all of the diagnostic messages.Next we are going to change the permissions of the files. Enter:
u - user r - read w - write x - execute Again, if there was an error, the exit status will be greater than
0
Next, we will change the flags:Now go back to your copy command and for good measure add
sudo
in front of it, and hopefully this will have resolved the issue.