Thursday, January 31, 2013

Chip SSD solution

Inspired by the SSD based setup on my machine at work I decided to speed up also my home Linux machine. Since Linux root partition is only 7Gb I don't need a big expensive SSD (which if even it's a small volume still pretty costly), I just bought a good USB3 flash drive  (The USB3 stick is really good. The random reading speed is 98MB/s.) formatted as Ext2 (Ext3 is not good for a flash drive since it constantly writes its journal to the same sector dramatically reducing the flash drive life time) and made the GRUB boot from it. GRUB sees the stick as (hd2). No extra steps was required.
The "/var" directory I left on the HDD, mounted to a partition which was prior that a swap space. I think I don't need swap with 8GB memory, right?

Monday, January 28, 2013

Windows on SSD

Made a new computer for my work place. It's not an upgrade, because the old one was not touched and completely replaced. I've got an ASUS motherboard (P8H77V-LE), an IvyBridge i7 CPU, plenty of memory, an Intel 520 series SSD for the system boot and a WD Black HDD for active work data.

To reduce the number of writing operation to the SSD, I moved some folders including my user profile to the HDD, and also instructed the system to create all new profiles there.

The latter is the most easy part, just change the registry value
HKLM\SOFTWARE\Microsoft\Windows NT\Current Version\ProfileList\ProfilesDirectory

To redirect all the other folders you need to create a junction between the expected location and the actual one. The full list of the folders which were moved to be located on the HDD:

C:\Users\%myname%\
C:\ProgramData\
C:\Windows\Logs\
C:\Windows\System32\winevt\
C:\Windows\ServiceProfiles\LocalService
C:\Windows\SoftwareDistribution\DataStore\

To move a folder I need to boot to the recovery console (reboot, F8, repair (if F8 does notwork, try F5))
In the repair console the drive letters are changed. The drive C: becomes E:

Important! If there more than two drives in the system, the target HDD could also change the letter. Make sure it's letter is the same in the recovery mode as in the normal operation mode! Unplug or disable (in the BIOS setup) all other drives.

Use the robust copy command which carefully copies all the directory structure:
robocopy /copyall /mir /xj E:\ProgramData\ D:\ProgramData\

after the command above successfully creates a directory mirror, rename the source directory (delete it if you are brave enough) and then make a junction (a link), using the following command:

mklink /J E:\ProgramData\ D:\ProgramData\

make sure, the ACL remains the same for the original and the junction, use the icacls command as follows (assume the current dir is E:\):


icacls E:\ProgramData\ /save ProgramData.acl
- before you put the original away

icacls . /restore ProgramData.acl
- after you have created the junction

Directories like the following can't be safely moved, windows does not even boot:

C:\Windows\System32\config
C:\Windows\security

 Also do the following:

1. Direct the %TEMP% and %TMP% environment variable to a HDD folder.
2. Make the page file on the HDD as well. Even if you have a lot of RAM, the page file is still required.

Use windows' Resource Monitor to check, that most of writes now go to the D: drive (HDD). Use the Sysinternals' ProcMon to collect a statistic about file operations and make decision what could be also moved to the HDD.