Contribute
Register

[HOWTO] Move /Users to a separate partition

Status
Not open for further replies.
Joined
Mar 11, 2010
Messages
2,122
Motherboard
Gigabyte GA-P55M-UD4
CPU
i7-860
Graphics
9800 GT
Mac
  1. MacBook Pro
Mobile Phone
  1. iOS
HOWTO move /Users to a separate partition
Last edits on: Jun 9, 2010

Why ?
To have a separate partition with users' home directories, as this makes it easier to backup and manage your installation...
And if you even want to reinstall your OS, your data will remain untouched.
This might be beneficial for owners of SSDs...

In this HOWTO, the following assumptions are used:
  • The administrator's user name is 'me'[/*:m:2jhxhlj2]
  • The /Users partition is the 2nd in the 1st HDD (disk0s3)[/*:m:2jhxhlj2]
  • We'll use /Local_Users as base for the users we won't be moving to the separate /Users partition[/*:m:2jhxhlj2]

Note: In the steps below involving 'sudo', you might be requested to enter your password.

Warning: Abandon all hope ye who enter here
Backup your data !
I'm not responsible if the procedure below sends all your precious data to the bits' paradise/hell, etc...
In other words, use at your own risk.

With that said, I've done it on my hack, and all is working nicely...



Procedure:
0) If your root user is enabled...
There's no need (i.e. it should be safe) to have the 'me' user's homedir in the /Users partition...
  • Login as 'root'[/*:m:2jhxhlj2]
  • you can skip directly to Step 4 (and obviously you won't need sudo...)[/*:m:2jhxhlj2]
1) Create a secondary Administrator account
  • Open 'System Preferences' | Account[/*:m:2jhxhlj2]
  • Click on '+'[/*:m:2jhxhlj2]
  • Add a new Administrator account - I used adm2[/*:m:2jhxhlj2]
  • Logout, and then login as 'adm2'[/*:m:2jhxhlj2]

2) Moving the me's Home folder to the main partition
  • In Terminal, issue the commands marked in bold below:
    $ sudo mkdir /Local_Users
    $ sudo mv /Users/me /Local_Users/[/*:m:2jhxhlj2]
  • Open 'System Preferences' | Account[/*:m:2jhxhlj2]
  • Right-Click on 'me' and select 'Advanced Options...'[/*:m:2jhxhlj2]
  • Change the 'Home directory' to be "/Local_Users/me", Click "OK"[/*:m:2jhxhlj2]
  • Logout, and then login as 'me'[/*:m:2jhxhlj2]

3) Remove the secondary Administrator account
  • Open 'System Preferences' | Account[/*:m:2jhxhlj2]
  • Select adm2[/*:m:2jhxhlj2]
  • Click on '-'[/*:m:2jhxhlj2]

4) Prepare Mount-Point
  • In Terminal, issue the commands marked in bold below:
    $ sudo mv /Users /UsersOld
    $ sudo mkdir /Users[/*:m:2jhxhlj2]

5) Gathering Partition's UUID
  • Open Disk Utility,[/*:m:2jhxhlj2]
  • Find the partition you wish to use as '/Users', Right-Click it and select 'Information',[/*:m:2jhxhlj2]
  • Select the value of 'Universal Unique Identifier', and copy it (Cmd-C)[/*:m:2jhxhlj2]
  • Close the information window[/*:m:2jhxhlj2]
  • Right click on the partition again, and select 'Unmount'[/*:m:2jhxhlj2]

6) Create the /etc/fstab with the contents shown below (I used vifs from within Terminal)
UUID=TheValueYouCopiedAbove /Users hfs auto

7) Mount the Alternative Users partition
  • Open Disk Utility,[/*:m:2jhxhlj2]
  • Find the partition you wish to use as '/Users', Right-Click it and select 'mount'[/*:m:2jhxhlj2]

7b) You might be interested in keeping ownership of files...
In Finder, right-click the 'Users' Volume, and select 'Get Info'.
Make sure the 'Ignore ownership on this volume' is NOT checked.

This can also be done from a terminal by issuing the commands marked in bold below:
$ sudo diskutil enableOwnership /Users/


8) Move all other Home directories to the new partition
  • In Terminal, issue the commands marked in bold below:
    $ sudo mv /UsersOld/* /UsersOld/.[^.]* /Users/
    $ sudo rmdir /UsersOld[/*:m:2jhxhlj2]

9) Reboot and verify the /Users is OK.
Under the root of your hard disk, you'll find that 'Users' has an HDD icon, and it's an alias.

10) Restore the 'Users' icon (instead of the HDD one) to the Users folder
  • In Terminal, issue the command marked in bold below:
    $ cp /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UsersFolderIcon.icns /Users/.VolumeIcon.icns[/*:m:2jhxhlj2]

11) If you don't want the Users Volume to appear as a separate one (i.e. on the desktop or finder's sidebar), append to the line you added in /etc/fstab ",nobrowse", as shown below
UUID=TheValueYouCopiedAbove /Users hfs auto,nobrowse

12) Improve performance by reducing unnecessary I/O
As most Unix-based file-systems, HFS+ also updates the 'access time' upon reading files (don't confuse this with change/modification time). Just browsing a directory will cause these accesses (e.g for previewing the file), leading to lots of unnecessary disk writes... And think of Time Machine...
On Linux, it's been reported to improve I/O performance by up-to-40% !

You can disable this by appending to the line you added in /etc/fstab ",noatime", as shown below
UUID=TheValueYouCopiedAbove /Users hfs auto,nobrowse,noatime


Enjoy !
Lnx2Mac :headbang:
 
MacMan said:
You could always enable root instead of creating a temporary account. :ugeek: :ugeek: :ugeek:
Cool, thanks for the tip ! :thumbup:
 
Edited the HOWTO...

- Added an option for users with root enabled (Thx Macman :thumbup:)
- Fixed ownership issues !
- Fixed 'Users' icon
- Added section on hiding the extra partition
- Added section on improving I/O performance by enabling noatime

Enjoy !
Lnx2Mac
 
Status
Not open for further replies.
Back
Top