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

Manually backup and restore a User Home Folder System
When troubleshooting a computer problem sometimes its best to just wipe the hard drive and start fresh. I developed the following method for backing up user home folders so that they can easily be restored to another computer or the same computer while preserving proper permissions, ACLs, and file/folder ownership.

To backup, use Disk Utility (in /Applications/Utilities/) to backup the user home folder.
  • Login as a local administrator, but not as the user account you want to backup.
  • Launch Disk Utility.
  • Choose File » New » Image from Folder...
  • Select the user's home folder /Users/[username].
  • Save the disk image to your backup drive.
  • Enter an admin username and password when prompted.
To restore:
  • When starting with a freshly restored or new computer use the Setup Assistant to create a local admin account that is NOT the same user name and short name as the user you are restoring.
  • Login as that local admin account.
  • Mount the disk image from the backup drive of the user's home folder you want to restore.
  • Switch to the Finder by clicking the Finder icon in the Dock.
  • Choose 'Go To Folder' from the Go menu.
  • Type /Users/ and click Go.
  • Copy the mounted disk image (not the disk image itself, but the white mounted disk image icon on the desktop) to the /Users folder by dragging it and holding the Command key. A green plus sign on the icon will indicate a copy and not a move is about to be performed.
  • When the copy is complete, the user's home folder will be restored with all its sub-folders, and all previous ownership and permissions will be intact.
  • Finally, use System Preferences to create a user account with the same username as the home folder. System Preferences will prompt you to verify you want to use the existing home folder for this account, and then will verify the home folder as having the correct ownership and permissions.

[crarko adds: This is the type of procedure I used before Time Machine automated the process. Before that I used to use ditto in a manner similar to this hint. There are many ways of doing this, but this one is pretty straightforward, and if for some reason Time Machine is not feasible this method will work.]
    •    
  • Currently 2.88 / 5
  You rated: 1 / 5 (8 votes cast)
 
[56,778 views]  

Manually backup and restore a User Home Folder | 16 comments | Create New Account
Click here to return to the 'Manually backup and restore a User Home Folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Manually backup and restore a User Home Folder
Authored by: drudus on Apr 05, '11 08:01:13AM

Provided the user account isn't the only admin account you can just use the System Preferences option to delete the user account. It prompts to archive the account to a disk image or a folder.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: Aaron Wyatt on Apr 05, '11 01:55:48PM

Deleting the account does not preserve ownership and permissions, as this method does. When deleting/archiving an account you're removing the user and all associated information, so the system changes the permissions to be accessible by other (admin) users.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: drudus on Apr 05, '11 02:21:23PM

Why would you want to preserve ACL's & ownership? The OS will restore the correct ownership after the new user is created on the new system.

Don't ACL's use the UUID of the account & not the user ID? So when you make the new account the UUID's no longer match? Right click the account in System Prefs & select Advanced options…

Anyway, if it works for you, great.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: Unsoluble on Apr 05, '11 07:59:36PM

Huh. The right-click-user-to-see-Advanced-Options bit should be a hint unto itself -- never knew about that! :)



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: everkleer80 on Apr 07, '11 09:18:20AM

Neat! Neither did I! Now I'm going to have to try right clicking in all such lists!



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: mvgfr on Apr 05, '11 08:48:08AM

> and then will verify the home folder as having the correct ownership...

Does it actually check the ownership of *all* files in the folder, including sub-folders?



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: afingal on Apr 05, '11 12:45:17PM

There's Time Machine and also the Migration Assistant. Most of the time, if there is storage available, I would want to back up the entire disk, probably as a disk image, using Super Duper, CCC, Disk Utility or ddrescue if things are really bad. Then you can install a new system, run Migration Assistant and select as many user accounts as you want to move from the backup to the new system.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: Aaron Wyatt on Apr 05, '11 01:58:17PM

Definitely true that Time Machine or other utilities will give you a more complete backup of the entire system. This process was designed as a quick and easy solution for moving user accounts between machines without migrating all data. It's easy to demonstrate and doesn't require much technical skill.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: poenn on Apr 05, '11 01:43:11PM

I usually do the backing up via System Preferences. Simply delete the account. You will get asked if you want to archive it in a disk image.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: Aaron Wyatt on Apr 05, '11 01:59:44PM

Again, using System Preferences to delete/archive the account does not preserve ACLs, permissions, ownership, etc..



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: cjraven on Apr 05, '11 11:41:34PM

Maybe I'm a dinosaur, but I rsync my $HOME to a small NAS daily, via a root cron job.

Given how few actual changes there are (other than data in Dropbox which is excluded from the rsync anyway) after the initial heavy run, daily rsyncs take mere seconds.

It's as maybe not quite as good as time machine or whatever it's called, but this method has worked for the past few years. I have had H/D's crash on me once or twice - oh yes, but never lost userdata, thanks to this method.

I suppose this is a pretty decent illustration of "whatever works for $you" :D



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: vekva on Apr 06, '11 06:46:56AM

Using rsync will also make it a recursive backup which is both faster and more practical than using Disk Utility. The downside is that it force you to the CLI.



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: cjraven on Apr 07, '11 05:29:22AM

Aaaah, but the CLI is a haven of refuge in troubled and unstable gooey times. It is predictable, it is always your friend.

The CLI doesn't care if you see other shells, or even have a beer after severely misusing it.

*cough*



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: tobylane on Apr 13, '11 02:37:28PM

What's your rsync command, the full line please?



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: cjraven on Apr 13, '11 09:46:27PM

Not terribly adventurous:

rsync -avz -e ssh /Users/username/ someuser@10.0.0.100:/home/username/macbackup/

ssh keys exist on both ends, I should add, thus eliminating any need for a manual login

HTH!



[ Reply to This | # ]
Manually backup and restore a User Home Folder
Authored by: shorts on Apr 06, '11 06:05:12AM

This is a good hint. But... There are things to consider before you go there...

There is no point doing this unless you are sure that it is a system level problem. First establish whether it is a system or a user level problem by reproducing the problem with a fresh user account. If you restore the user account, it may just bring back all that bad stuff.

Hope this helps :)



[ Reply to This | # ]