Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create an exact copy of your system UNIX
Here's a shell script that clones an entire Mac OS X file structure from one location to another. Though not an original concept here on Mac OS X Hints, the script demonstrates a good assortment of shell scripting tricks that every OS X geek should get to know.

[Editor's note: We have published articles in the past that discussed cloning the system. This script looks to be another valid method of doing the same thing, so I felt it worthy of publishing on its own. I have not tried the script myself.]
    •    
  • Currently 2.50 / 5
  You rated: 5 / 5 (4 votes cast)
 
[4,157 views]  

Create an exact copy of your system | 5 comments | Create New Account
Click here to return to the 'Create an exact copy of your system' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Why use cp?
Authored by: usunoro on Mar 15, '02 11:35:15AM

This script seems to assume you have the developer tools installed, so I wonder why it uses cp instead of CpMac, which comes with the DevTools, and handles resource forks....



[ Reply to This | # ]
Why use cp?
Authored by: usunoro on Mar 15, '02 11:37:46AM

uh ignore that, I misread the script :P



[ Reply to This | # ]
GUI tool does the same thing
Authored by: bombich on Mar 15, '02 03:23:37PM
I've developed a tool called Carbon Copy Cloner that does the same thing, except in a GUI. I also published similar instructions (actually an entire guide to backing up OS X, including shell commands) a while ago... Quick notes: ditto will fail if it encounters locked files, so you may want to execute "chflags -R nouchg,noschg [directory]" before using ditto. You also do not need to recreate the mach.sym link, it is recreated on every startup.

[ Reply to This | # ]
GUI tool does the same thing
Authored by: G42Go on Mar 16, '02 06:59:23PM

I admit your cloner app works great but I noticed one thing. Some of the properties / ownership /privileges have changed. Where the original file shows owner as root and group as admin the new folder has the owner as the User and group Unknown.
Is this because I run your app while booted into OS X ? I've corrected most of them but is there anything else you might suggest. thanks



[ Reply to This | # ]
Thanx Bombich!
Authored by: thinkyhead on Mar 17, '02 11:14:54PM

I've added a chflags command to the script as you suggested. I might add the folder-blessing also, but I don't know it's strictly necessary.

I just got a copy of Carbon Copy Cloner the other day and I have to say it's got a nice complete interface. It's certainly nicer than the GUI I was thinking of making for this script. I notice that CCC acts as a front end for an Applescript. Did you make it using Applescript Studio?



[ Reply to This | # ]