qiuping.com/blog 鄂郎传说,简单生活,快乐人生

Move Users directory to another partition

*原文太长,懒得翻译了。真找算这么做前,除了备份数据外先参考一下另一篇《如何把OSX个人文件夹从启动分区移到其它分区》。方法差不多。

I spent quite a bit of time looking for information on how to move my Users directory to another partition or drive in 10.4. I’m used to Linux, where you would just edit the /etc/fstab file and you’re done. Well, after reading a few articles, it was clear that it wasn’t possible to use the fstab file without problems, though I did find a few good articles for part of what I wanted to do. I’ve put this hint together based on several postings and recommendations from macosxhints and other sites.

I basically wanted to move my Users directory to another partition without creating problems when adding applications or doing backups. The following is what I did to make it work with Tiger. After setting up your partition or RAID volumes, proceed with the following. Note that this setup assumes there are two partitions, Boot and Users. The second partition is for /NewPartUsers.:

Read on for two different ways to accomplish this task…

Option #1: Preferred solution, as this version has a “safety net”

As part of this solution, we will retain the original Users directory, and move only the individual users’ home directories. The reason for this is so that we can create an Admin account and have it reside on the Boot partition and not on the Users partition. That way, if for some reason Apple changes something that breaks this, you can still login to the Admin account and fix the other user accounts.

  1. Set up all user accounts and restore user files if starting from a fresh disk drive, otherwise skip this step.
  2. Copy the user directories to the new partition with this command:
    	sudo ditto -rsrcFork -V /Users /Volumes/NewPartUsers
  3. Open NetInfo Manager and change the “home” path to the new path /Volumes » NewPartUsers » marty.
  4. Save your changes, log out, and log back in.
  5. If everything is working, rename the original user folder:
    	sudo mv /Users/marty /Users/marty.org
  6. Now create a symbolic link for each user’s account, so that the NewPartUsers path works as it should:
    	sudo ln -s /Volumes/NewPartUsers/marty /Users
  7. If everything is working, remove the original user folder:
    	sudo rm -dr /Users/marty.org

For new accounts added later, you will still need to follow similar steps:

  1. Create the new user’s account.
  2. Copy the user directories to the new partition with:
    	sudo ditto -rsrcFork -V /Users/newuser /Volumes/NewPartUsers/newuser
  3. Open NetInfo Manager and change the “home” path to the new path /Volumes » NewPartUsers » newuser.
  4. Save your changes, log out and log back in.
  5. Now create a symbolic link for each users account so that the NewPartUsers path works as it should:
    	sudo ln -s /Volumes/NewPartUsers/newuser /Users
  6. If everything is working, remove the original user’s folder:
    	sudo rm -dr /Users/newuser

That’s it for the first option…

Option #2:

If you don’t want to do all of the command line work every time you add a user, and want a more transparent approach, do the following. You will be able to add users as normal, and only require the NetInfo update after creating the user account. However, you will lose the safety net of the admin account access in the event of a problem.

  1. Set up all user accounts and restore user files.
  2. Copy the user directories to the new partition with:
    	sudo ditto -rsrcFork -V /Users /Volumes/NewPartUsers
  3. Open NetInfo Manager and change the “home” path to the new path, /Volumes » NewPartUsers » marty.
  4. Save your changes, log out and log back in.
  5. If everything is working, rename the original users folder:
    	sudo mv /Users/marty /Users/marty.org
  6. Now create a symbolic link for each users account so that the NewPartUsers path works as it should:
    	sudo ln -s /Volumes/NewPartUsers /Users
  7. If everything is working, remove the original user’s folder:
    	sudo rm -dr /Users/marty

For new accounts you will still need to follow similar steps:

  1. Create the new user’s account.
  2. Open NetInfo Manager and change the “home” path to the new path, /Volumes » NewPartUsers » marty.
  3. Save your changes, log out and log back in.

That is it. This worked just fine on my Mac Pro. I’ve run backups, Apple software updates, and various other applications without problems.

[robg adds: We've run hints on moving the Users folder in the past, but I thought it might be time to revisit. If you have a different process, please share in the comments.]

Via: http://www.macosxhints.com/article.php?story=2007041217125440


No Comments Yet


There are no comments yet. You could be the first!

Leave a Comment

快速拷贝文件路径 Mouse Locator — 大屏幕用户的必备