Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm moving a whole folder from one volume to another (both HFS+), using sudo mv, and thought ACLs would be preserved. However at the end of transfer I see that they haven't been kept, and since mv deleted the files in the original volume I can't restore them.

Why did this happen, and how to do it right next time?

share|improve this question

3 Answers 3

mv uses cp when moving files between different volumes, and it looks like the -p option isn't used, so ACL aren't preserved.

However if moved in the same volume ACLs are of course preserved.

share|improve this answer

It would be better to use the ditto command since it is aware of resource forks, HFS attributes as well as ACL. You can alias it or just rewitpre your brain to use ditto as best fits your workflow.

share|improve this answer

I'm quite suprised to read that ACLs weren't preserved. Do you have GNU mv installed and set to take precedence over /bin/mv?

According to the man page for mv (on both 10.5.8 and 10.8.2) cp -p is used when moving files across a filesystem boundary:

As the rename(2) call does not work across file systems, mv uses cp(1) and rm(1) to accomplish the move. The effect is equivalent to:

rm -f destination_path && cp-pRPsource_file destination && rm -rf source_file

cp -p preserves ACLs:

-p Cause cp to preserve the following attributes of each source file

in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved.

I moved a file to a flash drive and back with mv and ACLs were preserved (tested on my old PowerBook running Mac OS X 10.5.8 "Leopard" and with OS X 10.8.2 "Mountain Lion").

If both filesystems were HFS+ formatted, as you state, and there is no GNU mv around, I have to conclude that you are using some (very) old Mac OS X version. In that case either use the Finder, cp/rm or, as explained in bmike's answer above, ditto.

share|improve this answer
    
I'll try to find the time to reproduce; I'm no Lion server 10.7.5, and I don't think it's GNU mv but will check soon –  CharlesB Nov 28 '12 at 7:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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