Daily Archives: March 14, 2006

Moving a Directory from one Apple Mac to another with Target Mode

As we all get MacBook pro systems, we need to move out home directories back and forth. Here are my Chuck crib notes for the process.

This is my process when I switch mac’s. Boot the old mac in target mode.

Boot the new mac normally. Lets assume the account is ‘csev’.

Make a new account other than csev. Make this account an administrator.

Make a new csev account. Make the account an administrator.

Logout and login as csev. Once csev has logged in once log out and then log in on the other administrator account.

Start a terminal program .

$ sudo sh
Type your password for the non-csev account

# cd /Users
# mv csev csev.old

Plug in the target computer – It should appear as a disk.

# ls -l /Volumes

Make sure that you know the right volume that corresponds to your old disk – note that your new disk may be here too. If they are both Macintosh HD – there will be something that makes the mount point unique.

# cd /Volumes/whatever/Users
# ls -l
**** You should see csev

Now comes the nifty bit.

# tar cf – csev | ( cd /Users ; tar xfv – )

What this does is tar (no compression) up the directory from the target drive – send the output through a UNIX pipe, and then untar the files in the /Users directory in the new system.

Output will stream by. If you want to see the errors, remove the ‘v’ from the second tar. Don’t compress – (z option) it is a massive waste of time and CPU.

Once the tar completes, do the folllowing

# cd /Users
# chown -R csev.csev csev
This recursively sets the ownership of the files to the new account. Chown will complain about the -R option – ignore that.

Update 2009: They changed the syntax of the chown command in Mac OS/X 10.5 and later:

# chown -R csev:staff csev

When complete – close the terminal window, log out and then log in to the csev account.

Viola!