How to move osx /Users directory to another partition


how to move osx /Users directory to another partition? 

this what i think when i has to backup all my data to external hdd, when my osx have to reinstall, because "i think" (and its wrong) there's problem at my MBP, so here the step :

In this post, I'll explain in detail how to use a separate partition ("Volume" in Mac OS X parlance) for /Users.


While the actual procedure is not difficult, it involves several steps.
  • First, we'll rename /Users to /UsersOld, and we'll create a new /Users directory that will serve as the mount-point for our new partition
  • Then we have to edit the /etc/fstab to instruct OS X to automatically mount (that is, make it accessible) the new partition on /Users
  • Afterward, we'll "move" the contents of our /UsersOld folder into its new place.
  • Lastly, we might want to tweak the set-up a bit to make it look, as much as possible, as a regular installation

Mac OS X, being a Unix system, has the almighty 'root' user. However, on OS X Snow Leopard, it's disabled by default.
As we'll be using the 'root' account for this procedure, check Apple's support article on 'root' if yours is not enabled.


Throughout the rest of this guide, we'll also be using the Terminal.
I'll be marking the commands to be typed in bold, as follows:


SETTING UP THE NEW /USERS MOUNT-POINT

We'll now prepare the new /Users Mount-Point.
This is as simple as creating a Folder, and setting correct ownership and permissions.
# mkdir /Users # chown root:admin /Users # chmod 755 /Users #

IDENTIFYING THE PARTITION

Mac OS X identifies each partition by a UUID (Universal Unique Identifier).
We'll need the UUID to instruct OS X to automatically mount the partition in the next step, so let's gather it.
  • Open Disk Utility
  • Find the partition you wish to use as '/Users', right-click it and select 'Information' (or hit i)
  • Select the value of 'Universal Unique Identifier', and copy it (c)
  • Close the information window
  • If the partition is mounted, right-click on it, and 'Unmount' it

SETTING UP AUTO-MOUNTING OF /USERS

It's time to instruct Mac OS X how to mount our new /Users partition.
Being a Unix-based system, this can be done by editing the /etc/fstab file.
  • Before editing this file, it might be wise to save a backup of the original one.
    # touch /etc/fstab # cp /etc/fstab /etc/fstab.orig #
  • Launch TextEdit (or, if you are familiar with the vi text editor, you can use vifs)
    # open -a TextEdit /etc/fstab #
  • The TextEdit window opens (probably with an empty file if you haven't already edited it)
  • Make sure it's in plain text format (if not, select from the Format menu the "Make Plain Text" option)
  • Append the following line at the end of the file:
    UUID=TheValueYouCopiedAbove /Users hfs auto

    After editing, your file should look similar to:
    UUID=84BA91DE-C37F-F13D-B5C9-FECA5184DEB7 /Users hfs auto
  • Save the file and Quit TextEdit

MOUNTING THE NEW /USERS FOR THE FIRST TIME

At this stage, our /etc/fstab file is ready, and, on the next boot, Mac OS X should be able to automatically mount our /Users partition.
Let's verify that it can be mounted, as expected, on /Users.
  • In Disk Utility, find the partition you designated for '/Users', right-click it and select 'mount'
  • The new /Users Volume should appear in Finder (and in the Desktop if you selected that in your Finder's Preferences)

As we want to keep the same level of permissions as we had before the move, we'll make sure file ownership is preserved.
  • In Finder, locate the 'Users' Volume, right-click on it and select 'Get Info' (or hit i)
  • Verify that the 'Ignore ownership on this volume' is NOT checked.
If you prefer, this can also be done from the Terminal, as follows:
# diskutil enableOwnership /Users #

MOVING THE HOME DIRECTORIES CONTENTS TO THE NEW /USERS PARTITION

With our partition mounted, and permissions properly set, it's time to move all users' home directories to the new partition
Note that depending on the size of your users' home directories, the 'mv' command below might take quite a while to complete
# mv /UsersOld/* /UsersOld/.[^.]* /Users/ # rmdir /UsersOld #

We can now reboot and verify the /Users is correctly mounted ! 
At this time, all our users home directories are in the new partition, and as we instructed OS X to mount it automatically (via the /etc/fstab file), it should be accessible just as before.
... But don't uncork the champagne yet !

FINAL TWEAKS

You wouldn't notice it's been relocated, except for a couple of details:
  1. The familiar Users folder icon has been replaced by a disk icon,
  2. If you've set your finder preferences to show the hard disks on the desktop, /Users is also shown there.

We can fix these two easily:

Fixing the icon

Fixing the icon is as simple as Fixing the Orange HardDisk Icons, however, instead of using the Internal.icns file, we'll be using theUsersFolderIcon.icns file found in/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/

If you prefer, this can also be done from the Terminal, as follows:
# cp /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UsersFolderIcon.icns /Users/.VolumeIcon.icns #

Hiding the /Users icon

If you don't want the Users Volume to appear as a separate one (eg. on the Desktop, or finder's sidebar), we'll append an option to the line we added in /etc/fstab.
The option is nobrowse, and we'll add it immediately after auto, separated by a comma.
  • Launch TextEdit (or, if you are familiar with the vi text editor, you can use vifs)
    # open -a TextEdit /etc/fstab #
  • The TextEdit window opens with contents similar to this:
    UUID=84BA91DE-C37F-F13D-B5C9-FECA5184DEB7 /Users hfs auto
  • Change auto so it reads auto,nobrowse, as follows:
    UUID=84BA91DE-C37F-F13D-B5C9-FECA5184DEB7 /Users hfs auto,nobrowse
  • Save the file and Quit TextEdit
On the next reboot (actually, on the next mount), the Users icon will no longer appear on the Desktop or in Finder as a separate disk.

Caveats (Update 15-Nov-2010):
There are a couple of side-effects to hiding the /Users folder that make this a less-than-optimal solution:
  • Browsing /Users over the network is complicated
  • It will be hidden in the Time Machine "space" interface too, so it's tricky to restore files or folders.
    Showing hidden files is a way around this, but it clutters all Finder windows, and restores the /Users desktop icon (Defeating the purpose of nobrowse).
Given these two limitations I stopped using the nobrowse option.
I can live with that /Users icon on my Desktop !

Now... Where's that champagne !

Source : http://lnx2mac.blogspot.com/2010/09/moving-os-x-users-to-separate-partition.html
Share this article :
 

Post a Comment

 
Copyright © 2011. GixBox Log - All Rights Reserved
Proudly powered by Blogger