Results 1 to 9 of 9

Thread: Home Directory

  1. #1
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Home Directory

    Partitioning Guide
    Hard drive setup, install
    Damien's Moving "/Users"
    - Use this method first. Includes photos and easy to follow.

    Moving Users to New Drive
    - More about the troubles and traps that we sometimes fall into.
    Relocate User Directory using Terminal - Jazzbo Method
    - Ideal if wrapped into a script to deply and manage labs or large groups and organizations.
    - For the advanced who are familiar with the above, handy with the terminal.
    Moving Your Home Directory - adapted from Mike Bombich with photos.

    SymbolicLinker:
    Symbolic links are similar to aliases, except that they point back to the original file in a way that every Unix application can understand. Until now, however, creating a symbolic link usually involved a trip to the Terminal.

    SymbolicLinker is a tiny contextual menu plugin that, once installed, allows any user to create symbolic links to files inside the Finder. SymbolicLinker does this by adding a contextual menu item to the Finder that generates symbolic links to the selected files.

    The goal of this product is to decrease users' trips to the Terminal in order to use the "ln -s" command.
    SymbolicLinker
    Recovering home folder directory
    NetInfo Manager - A Portable Home Directory

    Mike Bombich's method:
    This is one of the simplest write up on how to move /Users to another partition or drive.
    quote:

    How and why to move your home directory to a different partition

    Moving your home directory to a separate partition can be very beneficial: if you ever need to reinstall OS X, you can simply format the OS X partition, reinstall OS X, and be up and running in less than an hour without having to spend time backing up your personal files. This entire task can be done with a few commands in the Terminal, and that is easier than explaining how to do more tasks in the Finder and NetInfo Manager. Type the following into the Terminal, substituting your username for "username" and the name of the other partition for "OtherPartition":

    sudo ditto -rsrc /Users /Volumes/OtherPartition/Users
    * [Ed. 'ditto' is the heart of CarbonCopy Cloner]

    (the next two lines should both go on one line)
    sudo niutil -createprop / /users/username home /Volumes/OtherPartition/Users/username

    sudo rm -dr /Users
    sudo ln -s /Volumes/OtherPartition/Users /Users

    Don't use the rm -dr command on the Users directory until you're sure the new one is working OK. You may want to log out/back in to check this.
    http://www.bombich.com/mactips/homedir.html

    If you don't want to use another disk drive, you can still benefit by leaving your home directory in its default location on the boot drive under /Users/accountname and just leave ~/Library there, and then use symboliclinker to point to another partition for all your large media files (Documents... Pictures) which can be on the same drive, separate partition, or a second drive.
    Just be sure to backup your files regularly!

    One of the strengths of Tiger Server is that it has great, easy to use tools to administer and manage networks and users and graphic interface, so you aren't flying by the seat of your pants, blind.
    Last edited by TZ; 12-28-2005 at 09:44 AM.

  2. #2
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb

    One of our moderators, well all of us, have come to recommend a "storage acceleration" strategy as well as how to optimize for Photoshop, for RAID.

    With a dedicated drive for the system, and another for /Users and media, each on separate channels, not on a shared channel like ATA's master and slave, you are spreading the work the system has to do.

    A fast boot drive that only has the OS and applications. A media drive. Perhaps a scratch drive or RAID. As much memory as possible. Backup sets. An emergency backup system - that you have insured works. Cloning the system 'as needed' before updating or installing anything.

    You can use part of the boot drive on a separate partition for static files.

    The easy way to 'see' and understand the whole "moving users" is Damien's
    http://www.macmeisters.com/~Damien/moveusers/

    I tend to test the system, and so do a backup/restore quite often, and having the system on its own drive/volume makes it easier. Sometimes just to see how a disk drive does compared to others.

    The only time a system seemed sluggish was after installing 2-3GB worth of iLife and other applications. Backup/Restore helped, but in the end, didn't need Garageband and others.

    But with so many files used by OS X, isolating the system and /User helps. Also, to reduce the need for the disk head to traverse the full drive surface (tracks).

    Optimizing and defragging a drive can have a negative effect. It 'clumps' files together. The worst scenario would be where the only free space to use takes a long seek, where the read/write head has to be traveling back and forth to find a file and file fragments. Then there is a 'debate' over whether having files "optimized" would be counter-productive where the head has to wait for another disk rotation to get the next file or fragment.

    Before I clone a system to a new volume, I put a 4.5GB file "holder" there, which I delete afterwards, leaving a 'hole' of 4GB at the front of the volume for the OS and 'hot zone' to use as well as for the directory.

    And every couple months, or with each "major" OS upgrade (10.4 to 10.4.2 qualifies as major) I clone to another drive, and the old drive becomes backup system and use the new drive.

    Pogue's "Missing Manual" covers the topic of moving the user account to another location in less than two pages. Damien's photos are the easiest way to get a feel for the process. The rest is "Why" and what to do if you make a typo mistake, or trying to get a handle on the idea. The more you do it, it is just like any routine you do.

    I've had my /User directory on another disk drive since 10.2.3. The only time I don't is when I have a 15K boot drive with enough space and avoid using the boot drive for anything except the home library, which is ~/Library where the ~/ is shorthand for the user's account directory, aka home folder.

    When you do get the system installed and updated sans 3rd party is also a good time to clone it (CCC, Disk Utility Restore both work; CCC works with 10.4.2 but not 10.4-10.4.1) to another disk drive; a disk image; a place for safe keeping to restore from, or to use if needed for an emergency, in which case Disk Warrior would be the only 3rd party tool most often in need.

    With 10.3.x you can also create a nice handy Emergency CD/DVD with BootCD from www.charlessoft.com (he is now asking for beta testers for Tiger version). BootCD lets you have a Finder, all your utilities, and can even run FireFox - so you can even get online if needed.

    The fastest part of the drive is the outer most tracks. When you remove the 4.5GB "holder" it means that files which are most active and changed will most likely go there. Swap file(s), caches. It grew out of my own benchmarking and experiments. An article on Windows XP and how it tries to move boot files to a special cache at the front of the drive so the system will appear to load faster on startup.

    Tiger maintains a small 128k 'hotfiles.btree' - a small directory of the most frequently needed files.

    Today's disk drives with larger caches and 'intelligent' firmware try to anticipate and load the next file fragment ahead of time. WD's Raptor drive is optimized for better disk writes and holding in cache more of what needs to be written out to disk. Mac OS X also 'defers' writes and writes to its own memory cache until it is ready. And then it updates the journal before it writes the live file. (You have to write a temp file anyway, insure it was written correctly, before you 'delete' or rename the old file and replace it to 'update' the file. When you update a file, you are writing more than once.

    Journaling makes your filesystem safer, has a small performance 'penalty' overhead, which is offset by deferring writes and caching at the OS level and at the disk drive.

    OS X, especially Panther and more so even under 10.4, uses as much free memory as possible to cache and hold disk I/O's, windows, code, and parts of the system, including even the Swap "file." The more memory, the better your system will run. The 'sweet spot' is or seems to be about 1.5GB RAM. Especially on G5s, but also on G4s. I think the G5 with 200MHz memory bus is happier when as much as possible is loaded into memory, AND because G5 code is handled differently, and should be coded and optimized differently. The G5 doesn't use L3 cache, and instead uses its own front side bus and memory instead.

    A disk drive only has one read/write arm. It can only really do one thing, and it does try to "queue" as many items as possible, even reorder requests, to be more efficient. That is where the whole "native" and "tagged" command queueing comes in (which works well for servers, and for OS X itself it seems, but not for generic desktop uses and can work against some operations. You'll see more about that in reviews of disk drive reviews and benchmarks.

    If you have a 7.2K drive with 2MB cache, upgrading to 8MB cache is almost like using a 10K drive with 2MB cache. Better to use a 10K drive with 8MB cache. Or 7.2K drive with 16MB cache. Or 15K drive with 8MB cache.

    Disk drives have always been the slowest item in a system. Along with faster CPU and more memory, it is still one area that can have a profound impact.

    The outer tracks might be able to be read in at 55-60MB/sec if they are all nicely spaced. The inner tracks at the other end are read in at 35MB/sec. The time to traverse would delay and slow down read/write operations.

    It helps to use the fastest drive you can. A WD 10K Raptor, or a 15K SCSI drive are good. The latest SCSI drives deliver 50-100% improvement with a deeper I/O queue, 89-95MB/sec. OS X is well suited to random I/O seeks which is where SCSI takes the lead but even 10K Raptor does fine.

  3. #3
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Initial Startup Assistant

    Setting up a Mac so it will re-run the Initial Startup Assistant:

    1. Set up the Mac as you want it (install apps, etc.)

    2. Reboot into single-user mode (reboot the machine and hold down the command +s keys as soon as you hear the startup sound.)

    3. You'll get dumped into the terminal. Wait for the command prompt to appear and type: mount -uw /

    -- This mounts the boot volume so you can edit it.
    ** Be very careful from this point forward.**

    4. Type: cd /Users
    -- Moves into the Users directory

    5. Type: rm -rf *
    -- Deletes all of the User folders (Shared, etc.) in the Users directory. BE VERY CAREFUL with this command - make sure you're in the Users folder. If you're not positive, type: pwd - the output should be "/Users"

    6. Type: cd /var/db/netinfo
    -- moves into the directory that contains the account information

    7. Type: rm local.nidb
    -- Clears the netinfo database and all of the existing accounts on the system

    8. Type: cd ../
    -- Moves up one level

    9. Type: rm .AppleSetupDone
    -- Remove the file that tells the OS that setup has already been run - note the period in front of the filename.

    10. Type shutdown -h now
    -- Shuts down the Mac

    Now the system will basically be back at its "virgin" state with no existing user accounts or user files.

    The OS looks for the existence of ".AppleSetupDone" and if it doesn't, it reruns the entire startup sequence (movie, create user, etc.).
    Restore NetInfo DB from defaults.
    Follow these steps:
    I. Start up the computer in single-user mode

    At the prompt (#), type:

    /sbin/fsck -fy
    Press Return

    fsck will then run.

    At the next prompt, type:

    /sbin/mount -uw /
    Press Return.

    2. This command renames the current NetInfo database, so that it may subsequently be automatically replaced:


    # mv /var/db/netinfo/local.nidb /var/db/netinfo/local.nidb.bad

    3. Optional (skip)

    4. Remove the AppleSetupDone file:

    # rm /var/db/.AppleSetupDone

    5. Restart the computer:

    # reboot
    How to replace the NetInfo Database
    Create a new administrator account
    How to recover a home folder (directory)
    Last edited by TZ; 06-15-2006 at 09:10 AM.

  4. #4
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Optimize System Using one drive

    This is an update or "post script" after having used a 2nd hard drive for "/Users" for three years and how to setup a single drive and still gain some benefit and efficiency.

    Use a new 160GB or larger drive with 8MB cache or larger.
    Partition the system volume to 40-50GB (or larger for rare users).
    Use a 2nd partition for most of what would go in the home directory, only use a symbolic link to point back to your home directory folder using SymbolicLinker.

    Create a symbolic link through the contextual menu of "Documents" folder on your 2nd partition. Copy it to your home folder. Rename it from "Documents_symboliclink" to "Documents".

    Keeping your system volume with your home directory Library, but without the additional files from Documents, Movies, Music, Pictures, etc. keeps it uncluttered. Your system will have the files most often accessed in the faster outer tracks.

    It is easier to use Applejack to clean caches, check for corrupt preferences, and repair your 2nd partition.

    If you have to reinstall the system, just backup ~/Library to the 2nd partition (as well as to other backup drives, either external, internal, or both).

    No need to mess with NetInfo Manager.
    No need for 2nd drive.
    Helps older Macs that may have to deal with "8GB rule" and small boot volumes.
    Easy to change.

    After using my system this way for a week, I have to say that 10.4.3 runs fine, better than older versions. My ~/Library folder is only 650MB so it fits on a CD, and doesn't add a lot to the size of the system volume.

  5. #5
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Force files to use outer tracks

    Can you improve your boot drive by creating free space on the outer tracks?

    Copy a 4GB DVD image to the boot drive.
    Install the system and updates.
    Merge your ~/Library from backup (synchronize or Migration Assistant).
    Delete the DVD image.
    All of the future writes (a lot of which are cache and log files and most active hotlist files) will be moved or written to first available free space. Including any VM_Swap files, which people are worried about having on fastest area (you wouldn't want more than one, and you would want VM Swap to be on the outer tracks).

    The outer 15% of a disk drive of course is where you have your best performance and lower seeks, as well as higher track density.

    Windows XP makes a system boot faster by using a boot cache area for system files of a couple GBs which is where and when I first thought about this. I use the 4GB DVD holder before cloning as well.

    One thing I want, is for the catalogue directory to be and remain unfragmented and room to grow.

    My general sense and feel and benchmarks (Xbench mostly) was that it does or may help. The theory, that cache files and additions would use the space held by the disk image 'holder' is something that I have not proven (by looking at the physical layout of files and what sectors they reside on).

  6. #6
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Home Directory

    Home Directory on Removeable Drive

    Part MacDevCenter, part "Mac OS X: The Missing Manual"
    - how to successfully place your home directory on an external portable or removeable drive.
    http://www.macdevcenter.com/lpt/a/1551

    SSH/Remote Access

    "If I'm not mistaken, the permissions on a user's home folder are 755 (rwxr-xr-x), this means the user themselves has full access to their stuff (as it should be), but both people in their group (which I think should be nobody on a normal OS X install), and anyone else on the machine, will also have read and execute permissions." On the factory install of 10.4.x, home folders are drwxr-xr-x by default, but the folders within them, except for Public and Sites, are drwx------.

    The public r-x permission on the home folder means the user's top folders within home (Documents, Library and so forth) can be seen, but the restricted access on group and world mean their contents cannot be accessed.

    (As a side note, an x permission without a corresponding r permission means a folder can be accessed, but its contents not read. The Drop Box in Public is drwxr-xr-x by default, which means it can be written to and accessed, but not read. This permissions set can be quite handy.)

    Being able to access everything in /Users, via ssh or otherwise, is an anomaly.

    The /Users/username directory has 755 permissions.

    But all of the standard folders inside of there (Except for Public and Sites) have 700 permissions, which allow only the owner to access the files therein.

    The lesson to take from this is not to store files outside of these standard folders. In other words, don't store files directly in the home directory. I'm sure some will find this restrictive, but that is the way it's designed to work. Organize the Documents folder as you wish rather than the home directory.
    Last edited by TZ; 06-15-2006 at 12:43 PM.

  7. #7
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Applications and symbolic links

    I have been wondering how to handle having 2 Applications folder and disliked navigating back and forth. All my applications that I install are in the directory above my User folder, this makes them available to all users to install or use.

    All the applications that the OS installer places on disk I left at root with root permissions.

    Create a Symbolic Link for the root Applications folder, (I called it 'root Applications') and placed it in my "Local Applications" folder.

    My Symbolic link makes it look like the root applications are in the User applications folder, cool.

    By using a symbolic link I can even change system folders and I still have all the applications linked since the symbolic link points to the root (or /) directory which is wherever the current system folder resides.

    New system installed with upgraded applications and utilities, no problem, the link automatically points to them.

  8. #8
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb Shared Users

    MacFixit Friday had a tutorial on setting up a triple-boot FireWire drive for OS 9, PPC OS X, and GUID partition scheme IntelMac OS X. And how to have a shared user folder account.
    __________________
    Step 6: Create a shared Users folder This process will create a shared user folder so that you can have a single account to manage all of your booting partitions. This way, no matter which architecture (PowerPC or Intel) you boot, you will have access to the same settings and information.

    1. First, boot from the FireWire hard disk on a PowerPC-based Mac. Create a new folder inside the "Users" partition, and name it "Users".
    2. Now drag and drop your home folder into the new "Users" folder.
    3. Next, open "NetInfo Manager" (located in Applications/Utilities). Click the lock at the bottom of the screen and enter your administrator password to authenticate.
    4. Click on "users" in the middle pane, and find the username you setup on your PowerPC partition, e.g.: /Users/(name of user)
    5. In the Property field at the bottom of the window, look for the "home" property. Double-click the value "/Users/(name of user)" and change it to "/Volumes/Users/Users/(name of user)" (without quotation marks).
    6. Next go to the "Management" menu at the top of the screen and select "Restart local netinfo domains."
    7. Log out and back in. Your home icon should now be in the Users folder you made.
    Now boot from the FireWire hard disk on an Intel-based Mac and repeat the above steps (except for copying the user folder). This time when you log out and back in again, you will see the exact same home folder you had on the other platform. The two are now sharing the one home folder. Changes made on one architecture will occur for the other as well.

    You now have a triple booting service drive with shared home folder. You may have to adjust permissions and other settings folders at the root of the users folder you copied, since just being dragged they didn't maintain the special permissions of the files at the root of your users folder.

  9. #9
    Join Date
    Jan 2001
    Location
    Mobius Strip
    Posts
    13,045

    Lightbulb

    10.4: Move Users directory to another partition
    Mon, Apr 16 '07 at 7:30AM PDT • Submitted by martycastilla
    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.:
    Boot partition: The partition where Mac OS and applications are installed.
    Users partition: The new partition that the user directories will be moved to, i.e. /NewPartUsers. (The following examples detail one user account named marty.)
    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.
    Set up all user accounts and restore user files if starting from a fresh disk drive, otherwise skip this step.
    Copy the user directories to the new partition with this command:
    sudo ditto -rsrcFork -V /Users /Volumes/NewPartUsers
    Open NetInfo Manager and change the "home" path to the new path /Volumes » NewPartUsers » marty.
    Save your changes, log out, and log back in.
    If everything is working, rename the original user folder:
    sudo mv /Users/marty /Users/marty.org
    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
    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:
    Create the new user's account.
    Copy the user directories to the new partition with:
    sudo ditto -rsrcFork -V /Users/newuser /Volumes/NewPartUsers/newuser
    Open NetInfo Manager and change the "home" path to the new path /Volumes » NewPartUsers » newuser.
    Save your changes, log out and log back in.
    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
    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.
    Set up all user accounts and restore user files.
    Copy the user directories to the new partition with:
    sudo ditto -rsrcFork -V /Users /Volumes/NewPartUsers
    Open NetInfo Manager and change the "home" path to the new path, /Volumes » NewPartUsers » marty.
    Save your changes, log out and log back in.
    If everything is working, rename the original users folder:
    sudo mv /Users/marty /Users/marty.org
    Now create a symbolic link for each users account so that the NewPartUsers path works as it should:
    sudo ln -s /Volumes/NewPartUsers /Users
    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:
    Create the new user's account.
    Open NetInfo Manager and change the "home" path to the new path, /Volumes » NewPartUsers » marty.
    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.]

    http://www.macosxhints.com/article.p...07041217125440

    The way I've always done it (when changing my user folder to a different volume called Data) is to open Netinfo Manager & go to Users.
    Then change the original from:

    /Users/*yourusername*


    To:

    /Volumes/Data/*yourusername*

    ____________________

    Dan Frakes had the definite answer to this question back in 2002.
    http://www.macworld.com/2002/06/secrets/osxsecrets/

    His method is more simple than what is presented here, and is battle tested.

    You can move your personal User folder to another volume with a few simple commands in OS X’s Terminal application.


    First, make sure that on the new volume, the “Ignore ownership on this volume” setting—in the volume’s Get Info window—is not checked. Second, back up—you should never do serious things like this without having a good backup. Then launch Terminal and type the following commands.

    (Note: Because each command is one unbroken line, and spacing is important, I’ve put the commands in scrolling boxes. You can copy and paste the commands into Terminal, replacing the appropriate values as noted below.)

    sudo ditto -rsrc "/Users/username" "/Volumes/volumename/Users/username"

    sudo niutil -createprop / "/users/username" home "/Volumes/volumename/Users/username"

    Sudo asks for your password to provide temporary root access, which is necessary for this exercise; in the above commands, volumename is the name of the new volume, and username is the name of your user folder.

    The first command (sudo ditto) copies your complete user folder, including all invisible files, to a new user folder on the volume volumename; the -rsrc option ensures that all resource forks are copied. The second command (sudo niutil) reassigns your home directory from the original location to the new location. (This Terminal command does exactly the same thing as using the NetInfo Manager utility to change the location of the property home for your user profile.)

    At this point you should log out and then log back in to make sure your user folder was copied properly to the new volume and your home folder was properly reassigned. (To check this, open your home folder in the Finder and then Command-click the icon in the title bar of the Finder window; the resulting pop-up display should show computername/volumename/Users/username.) If this was successful, open Terminal again and type the following commands:

    sudo rm -dr "/Users/username/"
    sudo ln -s "/Volumes/volumename/Users/username" "/Users/username"

    (Where, again, volumename is the name of the new volume, and username is the name of your user folder.) Here, the first command (sudo rm) deletes your original user folder. The second command (sudo ln) creates a symbolic link (similar to a Mac alias) from the main Users directory on the boot volume to your new user folder on the new volume (mainly so that it’s easier to find your personal user folder—its alias will appear in the standard Users directory on the boot volume).

    If you want to use this technique to move all user folders, remove /username from the first two commands above. However, you should remove (using the rm command) and link (using the ln command) each user folder individually, and leave the main Users folder and the Users/Shared folder alone, because some applications require you to have the Shared folder inside the Users folder on the boot volume.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •