Friday, November 13, 2009

Windows Server 2008 - saving space on the C:\ drive

One of the hardest parts of the move from Windows Server 2003 to 2008 for me is disk space - 2008 needs far more of it and some of my tricks on 2003 jsut don't work anymore. That said, disk space is not the killer it used to be since storage is so cheap now, but where we do have issues is small C: drives. Here is some steps to try when the C: drive is full up (most of these are valid for Windows Vista and 7 as well):
  • Pagefile. Find where the pagefile.sys is - it can be anywhere, there is rarely a reason to have it on C:. By default there will be one at c:\pagefile.sys of a system managed size, usually several gigabytes. You won't see it unless you turn on the Folder Option to see protected operating system files. To move it, right click Computer, Properties, Advanced System Settings, Settings (the top one), Advanced tab, Change. Select C: and "no paging file" and Set. Make sure you set another paging file before you click OK, and finally reboot (if you can) to make it take effect.
  • Remove programs. Maybe its obvious, but if you're out of space remove anything you can. Try organising them by size. Acrobat Reader always seems to be suprisingly near the top of the list...
  • Extend the drive! Not an option in Windows XP and 2003, but from Vista and 2008 the C: drive can be easily resized in Disk Management. Assuming you have unpartitioned space of course. It might even be an option to delete subsequent partitions on the drive to create unpartitioned space if there are any on that volume. Right click the C: drive in Disk Management (in Control Panel, Computer Management or Start > Run > diskmgmt.msc) and Extend.
  • Disk Cleanup. This should be among the first things you run as its a quick way of checking temporary files, error logs, etc that can be removed. Bad news is its not included in Server 2008 unless you install the Desktop Experience feature and reboot. After that, its in All Programs, Accessories, System Tools. Check this, even if you don't think you need to and install it on every server, just in case. The reboot requirement might not be an option in an emergency
  • C:\windows\system32\Logfiles. One of the best places to look on a Windows 2003 or 2008 server - especially if it hosts HTTP or FTP. If unused its about 3mb - on a web server though it can easily be gigabytes. The whole contents can be wiped without losing anything apart from the ability to analyse past web traffic (which you might, to be fair, want to do). If its big and you want the contents, right click the folder, click Properties, advanced, tick the Compress checkbox, press OK and Apply. It will apply NTFS compression from then on and save about 3/4 of the space in the directory for no loss of data. And then go into IIS and redirect your logs elsewhere...
  • NTFS Compression. Look for directories with big log files or text files in and compress them! It will slow down access a little but leave the files available and slash the space used. Its not so effective against binary information and useless against a ZIP file so use it sparingly. Remember if you "compress" a folder any new files in it will be compressed from creation. To turn it on, right click something, click properties and advanced. Remember it could slow backups down if that is an issue for you.
  • SQL Server Setup Bootstrap folder. Don't delete this lightly, but if you need space on a SQL Server machine, this can be a useful half gigabyte. It is used if you add components to SQL Server later on - without it you are more likely to need to CD. You might consider this to be a reasonable risk! Its location varies, but for SQL Server 2005 on x64 Windows 2008, it would be at C:\Program Files (x86)\Microsoft SQL Server\90\Setup Bootstrap. You can delete the contents, but leave the actual folder.
  • WinDirStat. [click here...] This is a very fine freeware utility which I've used successfully on a Windows 2008 Server. It analyses the disk space usage surprisingly quickly and gives you an easy to use report on where it all is. Very good for finding which directories have the space (much quicker than lots of right clicking and viewing folder properties!!!). Let's have a screenshot:

  • Windows Installer Cleanup Utility. [click here...] This Microsoft utility can be used to clear down the c:\windows\installer folder on x86 and x64 servers. This folder is, for instance, 3.3gb on my (fairly fresh) Windows 7 PC - probably less on a server as they tend to have less installs. This folder contains the Add/Remove Programs information for your applications so be wary using it, but if you are not going to change your configuration (such as deinstalling the programs) and you're desperate for space, its an option. There is a warning in the readme not to delete the main Office install data.


I'm sure there are lots more tips out there so I'll update this as I find them. Any suggestions would of course be welcome!

Tuesday, November 10, 2009

Black screen at Windows 2003 Login

Bit of a wierd problem we've had a few times on Windows 2003 servers, especially when they have run out of disk space on the C: Drive - not a blue screen of death, more a black screen of annoyance. The problem is that all the system colours are set suddenly to black (probably after a reboot). This is seen in Remote Desktop mode or local logon - only graphics work (like the Windows logo). You can actually log in and it should then be okay - if you can logon without being able to see anything!

Anyway, this is a known problem (http://support.microsoft.com/kb/906510) and has an easy fix. Open Regedit on another computer, click File > Connect Network registry, enter the name of the computer with the problem. Navigate to this reg key:

HKEY_USERS\.Default\Control Panel\Colors

And enter the values below! You will find they are all set to "0 0 0" (black) on the broken machine. Don't get them wrong, we did and ended up with a pink desktop! Very nice it looked too, so we left it alone.


Value name Value data
ActiveBorder 212 208 200
ActiveTitle 10 36 106
AppWorkSpace 128 128 128
Background 102 111 116
ButtonAlternateFace 181 181 181
ButtonDkShadow 64 64 64
ButtonFace 212 208 200
ButtonHilight 255 255 255
ButtonLight 212 208 200
ButtonShadow 128 128 128
ButtonText 0 0 0
GradientActiveTitle 166 202 240
GradientInactiveTitle 192 192 192
GrayText 128 128 128
Hilight 10 36 106
HilightText 255 255 255
HotTrackingColor 0 0 128
InactiveBorder 212 208 200
InactiveTitle 128 128 128
InactiveTitleText 212 208 200
InfoText 0 0 0
InfoWindow 255 255 225
Menu 212 208 200
Menubar 212 208 200
MenuHilight 210 210 255
MenuText 0 0 0
Scrollbar 212 208 200
TitleText 255 255 255
Window 255 255 255
WindowFrame 0 0 0
WindowText 0 0 0

Or if you don't like the idea of typing, just create a text file with the text below (including the Windows Registry Editor line...), save it with a .reg extension and import it into the registry:
Windows Registry Editor Version 5.00

[HKEY_USERS\.DEFAULT\Control Panel\Colors]
"ActiveBorder"="212 208 200"
"ActiveTitle"="10 36 106"
"AppWorkSpace"="128 128 128"
"Background"="58 110 165"
"ButtonAlternateFace"="180 180 180"
"ButtonDkShadow"="64 64 64"
"ButtonFace"="212 208 200"
"ButtonHilight"="255 255 255"
"ButtonLight"="212 208 200"
"ButtonShadow"="128 128 128"
"ButtonText"="0 0 0"
"GradientActiveTitle"="166 202 240"
"GradientInactiveTitle"="192 192 192"
"GrayText"="128 128 128"
"Hilight"="10 36 106"
"HilightText"="255 255 255"
"HotTrackingColor"="0 0 255"
"InactiveBorder"="212 208 200"
"InactiveTitle"="128 128 128"
"InactiveTitleText"="212 208 200"
"InfoText"="0 0 0"
"InfoWindow"="255 255 225"
"Menu"="212 208 200"
"MenuText"="0 0 0"
"Scrollbar"="212 208 200"
"TitleText"="255 255 255"
"Window"="255 255 255"
"WindowFrame"="0 0 0"
"WindowText"="0 0 0"
"MenuHilight"="210 210 255"
"MenuBar"="212 208 200"

Monday, November 9, 2009

Ubuntu 9.10 - making Grub2 look good

I've been using Ubuntu 9.10 for about a week now and I think it is fair to say all of my problems have been to do with Grub. Grub (the GRand Unified Bootloader - I don't know what is so Grand or Unified about it though) is upgraded in Ubuntu 9.10 from v1 to v2 - which appears to have caused widespread chaos, not least on my own netbook.

The rather basic Grub2 default menu

The first step was upgrading Grub to v2 at all. Since I had done an upgrade from Ubuntu 9.04 I still had the (working perfectly but, you know, old) Grub1 menu. There are lots of guides out there on upgrading so I won't reinvent the wheel. This one worked fine for me:


After upgrading I had the rather ugly menu above. It had extra menu options I didn't want (memtest x86 is a fine application but I know where the CD is thanks - I don't run it everyday) and was .

So, first thing to do was find nice background image! Everyone starts rebuilding their bootloader by sorting graphics, right? I went through the backgrounds in Ubuntu (in /usr/share/backgrounds), picked a simple one and made it 800x600 in The Gimp (I miss Photoshop...). It was 800x600 as that is the highest resolution Grub2 can switch to on an eee PC with its little screen (and no, it won't scale).

Editing Grub2 involves changing the config files then regenerating the menu, rather than the old way of directly editing menu.lst (which no longer exists). The menu options are built from /etc/grub.d/. Since I wanted to remove the memtest options, I remove the execute permission on the memtest file in this directory:
sudo chmod -x /etc/grub.d/20_memtest86+ 
I had saved the resized picture in my pictures folder but wanted to copy it to my backgrounds folder, where my other background images were.

sudo cp /home/edjakeman/Pictures/Climbing800600.jpg /usr/share/backgrounds/

Then I edited the Debian (Ubuntu) option from the /etc/grub.d/ folder to use the new background:

sudo gedit /etc/grub.d/05_debian_theme 

I found the section "Check for usable backgrounds" and edited it to include the directory I wanted to store the backgrounds in, the name of the file and the file type:

# check for usable backgrounds
use_bg=true
if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then for i in
{/boot/grub,/usr/share/images/desktop-base,
/usr/share/images/grub,/usr/share/backgrounds}/Climbing800600. {jpg,png,tga} ; do

I then edited the grub defaults file...
sudo gedit /etc/default/grub
In this I wanted to disable the recovery options (hey, they just look bad - why would I need them?! Its not like I mess about with system files for no reason) and change the resolution to 800x600. The important lines were:
GRUB_GFXMODE=800x600 GRUB_DISABLE_LINUX_RECOVERY="true"
Finally, this command used the config files to rebuild the grub menu - until its run the old configuration is still in place. This rebuilds the file /boot/grub/grub.cfg
sudo update-grub
My newly tarted up menu (that isn't me climbing)

Thursday, November 5, 2009

Ubuntu 9.10 on an eee 901 (or Karmic Koala killed my netbook part 2)

Okay, so perhaps I was overreacting a little when I claimed that Ubuntu 9.10 had "killed my netbook". After trying for another day or so my Asus eee 901 now has Ubuntu 9.10 installed on the 16gb drive and Windows XP installed on the 4gb drive. It turned out all my problems were grub related.

The process I went through was:
  • Install Windows XP on the 4gb drive
  • Swap boot order to look at the slave 16gb drive first in the BIOS
  • Install Ubuntu 9.04 (Jaunty) on the 16gb drive. Grub1 menu should work with Ubuntu and Windows
  • Upgrade Ubuntu 9.10 by logging in and using the Update Manager. When asked about the menu.lst tell it to keep the current one.
  • Wait 5 hours... :-)
  • Log into the now upgraded Ubuntu and become "concerned" that my mousepad had stopped working and there were multiple console errors.
  • Find a USB mouse and plug it in!
  • Realise it has written the grub1 menu wrong - its using an old version of the kernal, hence the mousepad errors.
  • Run sudo gedit /boot/grub/menu.lst to edit the grub1 menu. Copy and paste the main Ubuntu option near the bottom to make a new selection. Enter the correct kernal version. New option looks something like this (note the long uuid is specific to my pc):

title Ubuntu 9.10, kernel 2.6.31
uuid 008cd7d1-d763-429f-a540-dbxxxbe3f76
kernel /boot/vmlinuz-2.6.31-14-generic root=UUID=008cd7d1-d763-429f-a540-dbxxxbe3f76 ro
initrd /boot/initrd.img-2.6.31-14-generic
quiet
  • Reboot again using this option - confirm the mousepad can now be enabled and works. Comment out older Ubuntu options in menu.lst
  • Ponder upgrading ugly grub text menu to grub2...
So it was all Grub's fault after all. Happily running the Koala on my eee 901 now, and liking the new desktop backgrounds. It only took 2 days!

Wednesday, November 4, 2009

Karmic Koala killed my netbook

I don't want to sound bitter or anything. I'm probably doing something really unusual here. What I am doing is trying to dual boot Windows XP and Ubuntu 9.10 on an Asus EEE 901 (the one with a 4gb and 16gb SSD). Windows XP is installed on the 4gb and Ubuntu 9.04 was on the 16gb, which was set as the boot drive. Everything was fine but I obviously want to try the latest Ubuntu now its out - 9.10, "Karmic Koala".

I popped the Ubuntu Netbook Remix 9.10 disk in my external DVD drive, booted and installed, allowing it to wipe the 16gb drive and use it entirely.

Is that wrong? Really?

Anyway, the state this left it in after an apparently sucessful installation was when it boots I get the apparently infamous Error 15 message.

A quick search reveals I am far from the only person with this issue, but most of the solutions involve editing /boot/grub/menu.lst which in my case is missing altogether. So I use my highly useful Supergrub CD to boot (which works - not very convenient long term of course) into Ubuntu, which all looks satisfyingly more polished than 9.04, and I commence hacking about with Grub to get it working, with no real progress. Most of the solutions appear to be for 9.04, where this issue was hardly unknown, especially if you have tried to upgrade Grub. I wipe the whole thing and reinstall - same result. All this time you can imagine a weaker man might have pointed out to passers by that you don't get this kind of nonsense with Windows.

Anyway, deciding to come back to Grub I try doing other things and it is clear that there is more broken than just a boot menu. When I run Firefox, nothing happens. I try to run it again and I get an odd box called "Close Firefox" which then will not close. I try to run the take screenshot program (to record this chaos) but this does not work either! I borrow a digital camera off someone...

I give up. I install the eeebuntu version of "Jaunty" 9.04 and it works just fine first time.

I could take the blame myself and admit that I am no expert on Linux or Grub, but then I am hardly a complete newbie either, having been playing with Ubuntu for about 6 months and administering Linux servers for three years. I might have got this working if I was willing to spend a few days on it but quite honestly I should not have to. From this story on The Register lots of other people seem to be having random problems with this release. I am sure that under a lot of hardware Karmic works very well but its evidently not been tested on an eee 901, unless my installation really is that unusual.

I know its a cliche to say that Linux won't go properly mainstream until your average man on the street would have a chance of installing it, but its true. If I can't even install an OS on such a common piece of hardware, someone who was not technical would have no chance.

No wonder its free...

UPDATE - 06/11/2009

There are some clues here which I since picked up on. The screenshot of Grub Stage 1.5 means that Grub1 is still hanging about somewhere. The fact that /boot/grub/menu.lst was missing meant that Grub1 was not installed, but it had Grub2 installed, as it should being a fresh install. Apparently, despite the fact that I had erased the whole 16gb drive, it had not re-written the MBR. Hence the error 15 (which means "file not found" - no really?).

Its probably because I have the 16gb drive (sdb, not sda) set as the primary. And because the Ubuntu 9.10 installer was not tested properly! :-D