Friday, September 23, 2011

SQLSaturday Orlando Is Tomorrow!

Tomorrow marks the 4th annual SQLSaturday Orlando, held at Seminole State College in Sanford. We've got 46 sessions by 40+ speakers covering Business Intelligence, Database Administration, SSIS, Performance, and more. In addition, we'll have fantastic sponsors onsite to demo their products and what I hope ends up being one of the most memorable SQLSaturday lunches ever for attendees (for both the food and atmosphere).

It's hard to pick which sessions to attend with so many great ones at the same time, but here's some of the ones I'm most looking forward to:

Of course ALL of the sessions are going to be great and with the exception of my own time slot I expect to make some tough last minute decisions on which sessions I want to see the most. Somewhere in there I'll have to fit in networking and face time with all of the fantastic sponsors who are helping to make the day possible.

As if all of that weren't enough, make sure to stick around until the end of the day because we've got a lot of great prizes to give away. And finally, don't forget about the after party at Liam Fitzpatrick's in Lake Mary from 6:30 - 8:30 PM.

Haven't registered? Don't worry, there are still seats available - sign up here before it's too late!

One last note - we've made the schedule available for mobile devices (iOS, Android, Blackberry, and WinMo). First grab the Guidebook app here then download the schedule from within the app. This is hands down the best way to look at when sessions are taking place and it's free.

Checkin starts at 7:30 AM. I hope to see you there!

Thursday, September 8, 2011

Configuring Windows 7 For Paired Storage

In recent years solid state drives (SSD for short) have dropped in price enough to be an affordable option in most mid-to-high end laptops & desktops. However, despite their insanely fast IO speeds their limited capacity compared to traditional spindle based storage (HDD) remains one of the biggest drawbacks. This has given rise to the concept of paired storage - using an SSD and HDD in the same machine to achieve a balance between speed and capacity.

Storage guru Stephen Foskett (Blog | Twitter) recently blogged about how he's implemented paired storage on his MacBook Pro. I'm using paired storage on a Windows 7 PC so I thought I'd share how I set it up to work for me.

Hardware

My laptop (Lenovo T410) shipped with an ultrabay slot on the side occupied by a DVD-RW drive. I ordered the laptop with a 500GB HDD to max out capacity, and knowing I was adding an SSD I also purchased an ultrabay adapter that allowed me to remove the DVD-RW drive and replace it with the HDD. For the occasional times I needed an optical drive I picked up an adapter on Ebay ($17!) that turned the DVD-RW into an external drive that connects via USB. I found a decent price on an 80 GB Intel X-25M SSD which completed everything needed to run paired storage.

Installation

My goal was to run the OS on the SSD to take advantage of its speed but the laptop shipped with the OS on the HDD so I needed a way to move it over to the SSD. Most Windows laptops ship these days without any physical media; instead they include a recovery partition which contains a factory image that can be restored to the boot partition. Fortunately Lenovo included a utility to make recovery DVDs from that image, so the first step was to create recovery media. Once that was done I physically moved the HDD to the ultrabay slot, installed the SSD in its place, then plugged in the USB optical drive and used the recovery media to lay down Windows on the SSD.

A nice "feature" of the the recovery media is that it self propagates a recovery partition on the SSD. Because space is a premium and I have physical recovery media there's no sense in keeping the recovery partition around so it was promptly deleted and the OS partition expanded out to make full use of the SSD space.

With Windows installed on the SSD I formatted the HDD to prepare it for use.

OS Changes

All of the OS changes I applied were motivated by two reasons - minimizing SSD space used and reducing SSD writes. SSDs have a limited write life cycle and manufacturers figure that an average user will write less than 100 GB per day to them when they calculate how long the drive will last. Wear leveling algorithms help spread the writes around to maximize life, and it also helps to keep as much free space as possible on the disk so there are more bits to spread all those writes around on.

The paging file will typically be as large as the amount of RAM but because it's used infrequently it's a perfect candidate for moving to the HDD. Changing it involves more than just a few clicks, but it's not terribly hard - here's step by step instructions for how. I set the file size to 400 MB on the SSD to allow Windows to write a dump file if something catastrophic occurs and set the file size to System managed size on the HDD.

Hibernation is a feature I never use and keeping it enabled lets a multi-GB file called hiberfile.sys hang around taking up space. Even if I did use hibernation there's no way to move this file to the HDD. The easiest fix for this is disable hibernation and delete the file. Follow this link for how to do it.

User Profiles

User profiles in Windows 7 are located in C:\Users and contain system files to support a user's session while logged in along with a user's documents, music, photos, etc.. Some people suggest moving the entire user profile to the HDD; I prefer a more limited approach that involves specific folders so that system files within the profile remain on the SSD. There's two ways to go about doing this: move the folder to a location on the HDD or use libraries to include the additional folders from the HDD.

In either approach you'll first want to set up folders on the HDD with the same path and permissions as they have on the SSD. An easy way to do this is by using xcopy from a command prompt running as an administrator. Here's an example of the command looks if my username is Kendal, my HDD is drive letter Z:, and I want to create a new folder for documents:

xcopy /T /O /I C:\Users\Kendal\Documents Z:\Users\Kendal\Documents

The /T switch creates a directory structure but doesn't copy any files. /O copies permissions, and /I tells xcopy that it's dealing with directories (folders) instead of files.

Moving specific folders to the HDD is relatively easy. For example, if you want to move your My Documents folder then in Windows Explorer navigate to the folder's parent directory (e.g. using the previous example for xcopy syntax it would be C:\users\Kendal) , then right click on the Documents folder and choose Properties. On the Location tab you can change the directory to the new directory you created on the HDD.

image

When you click the OK button you'll be prompted to move any files that existed in the old folder to the new folder. If you choose No they won't be moved and the folder will stick around on the SSD. If you choose Yes then Windows will move the files to the new folder, present the appropriate prompts  to deal with any conflicts as needed, then delete the old folder.

Libraries are another approach that work just as well, and in some cases even better if the folders you're including in a library aren't part of the standard set that can be moved using the technique I just described (e.g. folders for Virtual Machines). Microsoft has a good overview of what libraries are and how to use them that you should read up on first if you're not familiar with the feature.

Before setting up a library I use xcopy to mirror folder paths and permissions to the HDD. Once folders are set up for documents, music, etc. I add them to libraries and mark the folder on the HDD as the default location for saving files. If you choose to use libraries you'll also want to configure applications to use the folders on the HDD by default, e.g. iTunes, Windows Media Player, and Picasa. (This is an extra step that you don't have to do if you move the folders as previously described)

There is also a visual quirk that happens when you add the new folder to a library where the view shows files grouped by each folder in the library instead of as one unified folder like this:

image

If you prefer to see all the files in a single view simply right click on empty whitespace, choose Group By > (None)...

image

...and viola!

image

Other Folders

Over time other folders on the SSD start to accumulate files that take up space but are infrequently used. One in particular is C:\Windows\SoftwareDistribution\Download. Windows Update uses this folder to store downloaded patches and updates; the entire contents of this folder is safe to delete. No worries if you delete a downloaded update before you've applied it - Windows Update will just download it again for you.

I recommend grabbing a copy of the free utility WinDirStat to find other large files and folders that are taking up space on the SSD. Some applications will create really large (several GB large) files nested somewhere within the AppData folder in your user profile path. Outlook puts .OST and .PST files there and if you've got an iPod\iPhone\iPad you'll see 4-5 GB device backups there as well. Another folder that consumes a lot of space over time is C:\Windows\Installer. WinDirStat will help you find them easily.

Once you've found them you can use xcopy to move their folders to the HDD, then use junction, a free tool from Microsoft Sysinternals, to create junction points to the folders. A junction point is essentially an alias which allows an application to access a file or folder as if it existed on a particular path but the actual path is somewhere else. If you're not familiar with junction points or how to create them I'd hold off from trying this option for now - otherwise you could create more problems than you're trying to solve.

Conclusion

Even though I'm not running on the SSD exclusively I still get fantastic performance. I can get from power on to logged in and read to use in less than 60 seconds and on average applications take no more than a few seconds to load. Because the HDD only contains files that are used infrequently I get all the speed of the SSD plus the storage benefits of the HDD.

If you've already got Windows installed and want to make the move to paired storage but loathe the thought of reinstalling Windows Lifehacker posted a very helpful guide for how to do it that's worth checking out.

If you're thinking about putting an SSD into your machine but worried about the lack of space then paired storage may be exactly what you're looking for.