4

I would like to copy the contents of a whole disk into another folder on an external drive.

it should preserve permissions and timestamps.

on linux i use cp -a but on OSX it seems to be different

nohillside
  • 92,308
  • 39
  • 198
  • 242
rubo77
  • 649
  • 4
  • 13
  • 28
  • 2
    just tried and `cp -a ` and it does work as expected. Are you getting an error? if you're trying to copy the whole disk you will more then likely need to run as `sudo`. also check `man cp` for more information. – hoss Aug 06 '13 at 18:20
  • Are you really still using 10.3? – lhf Aug 06 '13 at 18:43
  • the option -a doesen't exist in 10.3. I don't want to use 10.3 anymore. that's why I want to backup the disk before I do anything with it, cause I have no backup yet. – rubo77 Aug 06 '13 at 19:17
  • Why has nobody mentioned rsync yet!? :-) – Josh Aug 08 '13 at 20:09

4 Answers4

2

cp -a is just a shortcut for cp -pPR, these options are available in the 10.3 version of cp already. So you can copy the content of your disk with

cp -pPR /old/path /Volumes/new/path

You can also avoid using Terminal altogether and just drag the top folder you want to keep onto the external drive in Finder.

nohillside
  • 92,308
  • 39
  • 198
  • 242
  • 2
    The `Finder` copy will put all the copied files under **my** ownership. When copying a whole file system, this might not be the wanted result. – dan Aug 07 '13 at 10:34
  • If you delete the drag and drom hint, i could accept this answer – rubo77 Sep 14 '13 at 03:14
2

Download Carbon Copy Cloner 2.3. It is compatible with your version of MacOS X and processor. This solid software will preserve all the ACL, all the permissions and all the hidden files of your whole file system.

Once you have made your external copy, check it with the original Disk Utility.

Don't use a more recent version of Disk Utility which will want to fix many discrepencies…

which aren't.

dan
  • 11,624
  • 8
  • 52
  • 128
1

If you want to take a backup of your whole disk, while maintaining permissions, ACLs, timestamps, symlinks, etc... I would recommend to use tar instead of cp. Something like this:

tar cjvf mybackup.tar.bz2 <source>

and then extract the tar file in another location

tar xjvf mybackup.tar.bz2

To avoid the temporary file (which may be quite big) you can pipe them together

cd /path/to/source; tar cf - . | (cd /path/to/dest; tar xpf -)

Of course, if you are backing-up file a filesystem, shared by several users, you may need to do so as a root to overcome permissions problems.

nohillside
  • 92,308
  • 39
  • 198
  • 242
Bichoy
  • 174
  • 1
  • 1
  • 7
0

Another useful method is to use cpio. It can preserve hard links and can handle some long filenames which are not supported into tar. You can check more details here for a nice comparison between the three techniques.

I believe all of the methods word, you should just fine that suits your needs and do the job more efficiently.

Bichoy
  • 174
  • 1
  • 1
  • 7