How do you properly backup and restore "Users" files and folders?

rhinosaur

Registered
Okay, this may seem silly, but there's no such thing as a dumb question. I've been working with OS X since the beta days and I'm still stumped on this one.

What would be the proper way to backup and restore your users and their files? I came across this problem when my dad's HD needed a little reformatting. I told him to just back his stuff up to CD and then he could wipe the drive, reinstall his OS and move his files back.

He made the mistake of using different Usernames after reinstalling OS X, So all the file privileges were wrong. But, he used the same username as before with his account and he too had privilege problems with his files.

So, I'm just curious, what would be the best way to approach this type of situation to avoid user privilege problems in the future? And doesn't this seem like a potential problem for the new user who may have to do as Apple recommends and reformat their HD before reinstalling OS X?
 
I just did a re-install of OS X on my machine a couple weeks ago. Luckily, I have two internal drives & only two users on the machine. Here are the steps that I did to save the users from the terminal (note: "molson" is the name of my second hard drive):
<ol>
<li><code>cd /Users</code></li>
<li><code>sudo tar -cvf diane /Volumes/molson/diane.tar</code></li>
<li><code>sudo tar -cvf kevin /Volumes/molson/kevin.tar</code></li>
<li>Re-install OS X (obviously not from the command line)</li>
<li>Create users kevin and diane</li>
<li><code>cd /Users</code></li>
<li><code>sudo tar -xvf /Volumes/molson/diane.tar</code></li> <li><code>sudo tar -xvf /Volumes/molson/kevin.tar</code></li>
</ol>
If you need to change the owner of the files (say for kevin), you would simply need to do:
sudo chmod -R kevin kevin

The only addtional negative of this was that I lost the custom login icons from the login screen (but not that big of a deal for me...).

kevin
 
I don't understand why rhinosaur would be having any problems, or that he would need to use any of the cryptic commands given.

When I reformat my machine (I've done it twice now), I've always just grabbed my home folder, burn it to CD or put it on my iPod, reformat, reinstall, and update OS X to the latest version (making sure you create a user with the same username), and then just drop my home folder back into the "Users" folder.

As long as you copy the folders to another drive using the Finder in OS X, you should have no problems. If you had to backup using OS 9 or something (because of a filesystem problem), then you might have problems, but I've never backed up this way.

I have had absolutely NO problems doing it this way, and it SHOULD work – yes, I did it via the Finder. The webmaster at railheaddesign.com did it this way too, and it makes it very easy. Both of my times it did not mess up one bit – not even permissions, even though I had copied via the Finder.

Are you sure you did it exactly this way, rhinosaur? Any steps that you took that could have messed it all up?
 
Count another vote for the "ditto -rsrc" command. After a couple of mishaps using other backup methods, I learned about ditto, and it's worked perfectly for me ever since.
:D
 
Originally posted by testuser
Using the Finder to copy files to another volume has always screwed up permissions in my experience...

In some people's opinion (mine included) this is a bug, so I filed a bug report on this issue (radar 2809128) but was later told that the Finder is behaving as expected...so I take that to mean you don't want to do any copying in Finder of sensitive files.
 
Perhaps the initial trouble lies in the idea that once you reinstall the OS you have to create new users?

It never occurred to me to just drop the backed up users folders back in the "Users" folder. For some reason that just didn't come to mind. But now it sounds quite reasonable. I assume then, that there is no reason to use the System Prefs to create new users in that case, and that if I just drop the users folders in the "Users" folder then all the settings, passwords, privileges, etc., will work as they did previously. Ah...it's so obvious, I guess that's usually the best solution.

And as far as the terminal is concerned, while I'm certainly not shy about messing with a little command line, it certainly isn't the kind of thing everyday users should have to contend with to simply back up and restore files. I can't imagine trying to talk my dad through doing anything in the Terminal.

thanks for all your help.
 
No!

You cannot just merely place a folder in the Users folder and have all the settings appear.

You DO need to recreate the user via the "Users" preference pane.

One thing you might try instead is copying the CONTENTS of all the files inside the main folders (Library, Movies, Music, etc.). That will at least preserve the permissions of the folders. You still need to recreate the user, though.

But, yes, my solution has worked perfectly for me, and my permissions are fine.
 
Create your users using the system prefs pane with exactly the same username and exactly the same password...would there be any reason to create your users in exactly the same order as another reply recommends?

I'm cool with all the legwork, but it still seems a bit of a hassle for a less than system savvy user. Thanks again for all the comments.
 
Originally posted by rhinosaur
Create your users using the system prefs pane with exactly the same username and exactly the same password...would there be any reason to create your users in exactly the same order as another reply recommends?

I'm cool with all the legwork, but it still seems a bit of a hassle for a less than system savvy user. Thanks again for all the comments.

Neither the username nor the password of the re-created users need to be the same; their UIDs, GIDs, and home directories do, however.

Luckily, these can be modified using netinfo browser.

Unix (and OS X) track file ownership via UID, and not username: so users A and B with the same UID are the same user to the system. It is just that login(1) is going to put them into different home directories, with different default shells.

The reason why re-creating users in the same order works is due to the fact that these users just happen to get the same UID and GIDs as before (same algorithm is used).

Another way to fix this is by using chown/chgrp as root.
 
Originally posted by ladavacm
Neither the username nor the password of the re-created users need to be the same; their UIDs, GIDs, and home directories do, however.

Luckily, these can be modified using netinfo browser.

Unix (and OS X) track file ownership via UID, and not username: so users A and B with the same UID are the same user to the system. It is just that login(1) is going to put them into different home directories, with different default shells.

The reason why re-creating users in the same order works is due to the fact that these users just happen to get the same UID and GIDs as before (same algorithm is used).

Another way to fix this is by using chown/chgrp as root.

Ladavacm...so in effect what you are saying is what apples says here am I correct?:
8. Type "/Users/" and click Go.
9. Drag the contents of the Users folder to the Trash.
10. From your backup storage location or disk, drag the contents of the backed-up Users folder into the empty Users folder on the Mac OS X disk.
11. Put away or eject your backup disk.
12. Open Terminal (/Applications/Utilities/).
13. Type: chown -R <username> /Users/<username>

Important: In this step and in Step 15 below, you would replace " <username> " with the actual user short name, which should match exactly the name of the user folder. So for a user named Jeanne DuBois with a short name of "jeanne", you would type:

chown -R jeanne /Users/jeanne

14. Press Return.
15. Type: chgrp -R staff /Users/<username>
16. Press Return.
17. Repeat Steps 13 through 16 for each additional user that you created in Steps 2 through 4, if applicable.
18. Quit Terminal.
19. Choose Log Out from the Apple menu.
20. Log back in as your normal Admin user.
21. Be sure that you can access your files. If you cannot access your files, log back in as root and repeat steps 13 through 20.
-----end

...also do I have to log in as root? Can't I just sudo or does the account need to be inactive in order to modify it?
 
Back
Top