Showing posts with label OS X. Show all posts
Showing posts with label OS X. Show all posts

Thursday, December 1, 2011

Speeding-Up My Mac Pro

We love our Mac Pro. It's an early model from Apple; designated the MacPro1,1, it was built way back in November 2007. It has served us faithfully and reliably for several years now. However, the two 2.66 GHz Dual-Core Intel Xeon processors are getting a little old (from a technology age standpoint), and it no longer has the pep of a shiny, brand new machine. I considered the possibility of purchasing a new Mac Pro, but just cannot justify the expense at this time. So I decided to look for ways to breathe some new life into the box I already owned.

Although this blog specifically references the Mac Pro, the same changes could be made to other models of Apple computers that have more than one hard disk. Use the advice provided in this blog at your own risk. We are not responsible for any damage to your computer or loss of data that may occur!

The Mac Pro uses Serial-ATA (SATA) technology operating at a 3 Gigabit link speed to support its data storage devices. I've upgraded the drives a few times and currently have 5 Tb of hard disk storage provided by a combination of four SATA drives. One drive stores the OS X operating system, the second is used for local data storage, the third is used as a backup drive for the local data, and the fourth drive is used for Time Machine. I know there is a lot of backup storage here, but the two methods of archiving copies (plus occasional backup to external hard disks) has saved my rear end more than once.

As fast as the 3 Gigabit SATA hardware is, spinning magnetic disks remain a performance bottleneck. But all is not lost, because the beauty of the SATA hardware is that it can access multiple drives at the same time. What I discovered is that Apple's default method for locating folders does not take advantage of this capability, and herein lies my zero to low-cost method to improve the performance of your Mac Pro.

A few months ago I installed a nifty menu bar app named DiskLED. This app provides a disk activity monitor that can be customized to display an icon in the menu bar that changes color with disk activity (think traffic light with red, yellow, and green indicators). What I noticed right away was that the disk where OS X resided was constantly being hit, and hit hard. The corresponding icon was almost always colored red, while the disk with my local data was only sparingly used when files were loaded or saved.

When I viewed the folder structure of the main disk, I noticed that it not only contained the OS X files, but the Users folder as well. While I had already moved much of my data from the Users folder to my local data storage (i.e. the music, movie, and photo libraries), there was still a lot of other data in the Users folder. Specifically, there are a lot of user-specific application settings and support files that are located in hidden files and folders, and they are apparently accessed quite often as you use applications. If you would like to view these hidden files and folders, you must first tell Finder to reveal them. You can do this by opening the Terminal app and entering the following commands:

     defaults write com.apple.finder AppleShowAllFiles TRUE
     killall Finder

To return Finder to its default of keeping these certain files and folders hidden, enter the following commands in Terminal:

     defaults write com.apple.finder AppleShowAllFiles FALSE
     killall Finder

It was my hypothesis that an easy way to better leverage the speed and capability of the fast SATA devices was to separate the operating system and applications from the user data. However, it's not simply a matter of dragging the Users folder to the neighboring hard disk. Here is the process that is required.

1) Preparation

Start out by creating a backup of your hard disk that contains the operating system, applications, and users folders. It's better to be safe than sorry.

After you have successfully created the backup, it's a good opportunity to do some spring cleaning. Delete some of those old apps you have never used, delete user accounts that are no longer needed, clear your web browser(s) cache, and empty the Trash.

My final preparation step is to open the Disk Utility app and select the corresponding hard drive, and Repair File Permissions. This will help to make certain that the Users folder is in good order before it is moved.

2) Copy the User Folder

To copy all of the files and folders within the Users folder, including the hidden, locked, and system related files, you should use a backup or copy utility such as Synchronize! Pro X, SuperDuper, or Carbon Copy Cloner. These utilities are currently free to use on a limited basis, but we believe that these types of apps are invaluable for maintaining a scheduled backup of important files and folders. We recommend that you consider supporting the developers and purchase a copy.

Select as the source the operating system drive and the Users folder only. Then as the destination, the local data drive. Click on copy / clone and wait patiently for the data to be copied between hard drives. An example screen shot from Carbon Copy Cloner is shown below.


3) Link Each User Account to the New Users Folder Location

This is an important step. You must tell OS X to use the new location for the Users folder, otherwise it will continue to look for the folder in its original location. Open System Preferences, then select Users and Groups. Click the lock to enter your admin password to make changes. Now for each account, Control-Click the account name for access to Advanced Options. Then for the Home Directory entry, click on Choose to navigate to the new location of the Users folder. An example screen shot from the Users and Groups dialog is shown below.


You must repeat this linking process for each user account.

In order to activate the link to the new Users folder location, you must restart your computer. After restarting, you can verify that you have linked to the new location by navigating to the Home Directory, Control-Click on the "Home" icon and select Get Info. Here you will see the path to the folder, and it should designate the new drive location.

4) Delete the Old Users Folder

With the User folder successfully moved and linked to the new location, you can now delete the old User folder. After sending it to the Trash, empty the Trash.

5) Create a Symbolic Link to the New Users Folder

This last step may be the most important. Many applications (i.e. iTunes) will look for the Users folder on the same hard drive where OS X is installed. However, we have moved the folder, thereby "breaking" the application. We can fix that by creating a symbolic link to the new folder location.

Don't be fooled. A symbolic link is not the same thing as an alias. A symbolic link (symlink) is recognized by the OS X filesystem, whereas an alias is only used by Finder. The easiest way to create a symlink is to use a utility named Symbolic Linker. Download the utility and carefully follow the installation instructions. Then Control-Click on the Users folder and choose to Make Symbolic Link. You will now have a new folder named "Users symlink". While holding the Command key, drag and drop this folder to the same location as your original Users folder (that you have since deleted). Holding the Command key forces the folder to be moved instead of copied between hard drives. After you move "Users symlink", rename it to "Users". Now every application that looks for the Users folder will be redirected to the new location on your local data drive.

6) Enjoy the Improved Performance

That's it! You have successfully moved the Users folder. Now the Mac Pro will more effectively use the computer's fast SATA capability to access data from multiple drives simultaneously, essentially increasing the speed of the computer.

I have not completed benchmark speed tests to scientifically quantify the performance improvement, but anecdotally, applications do run faster. Observing the DiskLED icons, I can visually see that the OS X drive is no longer being accessed constantly since the files have been spread across two drives. This is most obvious when using disk intensive graphics applications like iPhoto or GIMP.

As a bonus, moving the Users folder will make it easier to transition the user data to a new computer because all of the data is installed on one drive. This also makes creating backups a more simple process; I no longer have to select specific folders from the OS X drive, I just backup the entire local data drive!

Tuesday, January 27, 2009

Mac OS X Lessons in File Permissions and Installation Discs

I am fairly confident in my ability to perform a number of administrative tasks on both Mac and Windows computers. Unfortunately, I may be a bit too confident.

Recently, while working to modify the file permissions on a secondary hard drive installed in our Mac Pro, I allowed my mouse finger to work faster than my brain and I wound up changing the file permissions on the hard drive that holds the operating system and network user accounts.

Uh-oh.

As soon as I clicked the mouse button the world started moving in super-slow motion. It was one of those events that made you wish that you could go back in time for just a few seconds, just like they did in one of my favorite science fiction comedies, Galaxy Quest, where the characters have a beryllium-powered time machine.

So I found myself in a predicament. With the file permissions changed on the OS X drive I was unable to access any applications or files. I was essentially locked-out of using my computer and there it sat in a sad, disabled state.

"No problem!" I told my wife, I figured I would just pop in the OS X installation DVD, access the Disk Utility application and set the file permissions back to their default values. So I dug through my collection of old software discs to find the Mac Pro's gray-colored OEM ("original equipment manufacturer") installation DVD and proceeded to reboot the computer to begin the process.

Not so fast there mister techno-geek.

I booted the Mac Pro holding the Option key (or ALT key if you're using a Windows keyboard). This start-up option will present you with a screen that allows you to select which connected device to boot from. I chose the OEM installation DVD and waited patiently for the installation application to bring-up the menu where I could locate the Disk Utility. Instead I was greeted with a 'kernel panic' screen (see image).

That's not what I was expecting.

So I booted again, this time holding the 'C' key right from the start. This option will force the computer to load the operating system from whatever disc happens to be in the CD / DVD drive.

Kernel panic again... not good.

The kernel panic screen is normally displayed when a Macintosh computer encounters some type of fatal error from which it cannot recover. Such errors are usually attributed to a hardware issue (i.e. bad memory, disk controller, motherboard, etc.). I was confused. My Mac Pro had operated just fine until I changed the file permissions, why was I receiving a kernel panic?

"No problem!" I told my wife again. If I could not access the Disk Utility via the Mac's graphical user interface ("GUI"), I would just use another cool start-up option, holding the Command and 'S' keys while booting the computer to access a good old-fashioned command line through what Apple calls single-user mode.

Soon enough I found myself at the command line and after locating the brain cells that were not killed-off while I was in college, I recalled some of the basic commands needed to navigate via the text-based interface. In a few minutes I was executing commands that allowed me to check the disk for errors (Phew! None found!) and to mount the drive to be writable. However, when I attempted to run the Disk Utility application to repair file permissions I was denied. Evidently, this operation cannot be performed in single-user mode.

Uh-oh (again). Now I was getting nervous. Somehow I had to get to the Disk Utility application from the installation menu.

I was stumped at why every attempt to load the installation DVD resulted in a kernel panic. I found some obscure references on the Apple support site that suggested the OEM installation disc was specific to the original configuration of the computer; so if the user had added more memory or another internal hard drive, the OEM installation may not work. The user would need to remove the added memory or storage device to bring the computer back to its original specifications.

Think man, think...

Well, I hadn't added any memory. I hadn't changed any of the storage devices. The only thing that I had changed from the as-purchased configuration was the video card. The original economy-model nVidia GeForce 7300 GT crapped-out just after the one-year warranty expired, so I had replaced it with a nVidiaGeoForce 8800 (much better!). The failed video card had been discarded long ago, so it could not be reinstalled to bring the machine back to original specifications, and besides, it had failed; it wouldn't have worked even if I had it handy. Certainly, Apple would not allow a replacement video card, one that I had to be replaced because of failure, to prevent me from using the OEM installation DVD.

Au contraire Apple breath.

It seems that the gray-colored installation discs that come with your high-priced Apple computer are essentially worthless the moment you must replace any failed component in the device.

That hardly seems fair to me.

Well, I had no choice but to stop by the local computer store and purchase a OS X installation disc. Not a gray OEM version, but the full-blown, black-colored, retail version.

I inserted the new DVD, and booted the Mac Pro holding the 'C' key. Presto. The installation menu displayed as expected and I was able fix the file permissions and save myself from total embarrassment. The only price to pay for my 'over-confidence' was the $130 for the new copy OS X. A cost that I blame on Apple, since the crippled OEM DVD that they provide with each new computer purchase is absolutely worthless.