Monday, April 7, 2008

Resizing partition in Windows Vista

I was faced with the usual problem. Reiszing an NTFS partition with Windows Vista on it.
Trying out the "good old" solutions: get a 3rd party software, resize is, and you'll be faced with an error:

File: \Windows\system32\winload.exe
Status: 0xc0000225
Info: The selected entry could not be loaded because the application is missing or corrupt.

and you'll need a repair installation. :(
Described here:
Using GParted to Resize Your Windows Vista Partition
and on many more sites.

Not so fast! There is partition resizing in the OS itself! :)
Can I repartition my hard disk?
"Yes. It's possible in this version of Windows to repartition your hard disk by using the Shrink feature in Disk Management."

Thumbs up for Windows Vista! :)

Monday, March 31, 2008

More recovery console annoyance

Let's suppose your Windows XP won't start. (Because you wanted to try out Ubuntu and installed on it. Then deleted the Linux installation, but it installed GRUB, which remained.)

There must be several problems, which prevents Windows XP from starting, but the most obvious ones:
- damaged MBR (Master Boot Record)
- no active partition
- damaged boot record

Do not worry! You just need a Windows XP installation CD and boot recovery console.

GRUB is installed in the MBR, so just use FIXMBR, to repair it.

Still no luck? Use FIXBOOT to fix the boot record?
What? It gives an error, because it cannot find the boot partition?
But recovery console found the Windows installation.

So, try this: FIXBOOT C:
And it successfully writes a boot sector.

But it will not mark the partition active.

Come On! How should I do it? Do I need some 3rd party utility?

Yes. :(

Friday, February 15, 2008

Day of the Week from a command line

So, I needed to get DOW from a Windows command line.
There must be several other options, but I use the following:


wget some_url/dow.php
echo Today is:
type dow.php


And you need dow.php copied somewhere on a php enabled web host:

< ? p h p
echo date ("l");
? >


(You can find WGET for Windows at my previous post)

Do you have some other way? I am open to suggestions! :)

Tuesday, February 12, 2008

Monitor your web server

We have our own web server (LAMP) and I wanted to have some monitoring. I have a Windows workstation, which does some scheduled task, so I just made my own monitoring script.

It has a server side part, which gives the result "OK", when Mysql, PHP and Apache working correctly:

< ? p h p (spaces are not required)
$con = mysql_connect( "localhost", "mysql_user", "password" );
if ( ! $con )
die( "Error in Mysql connect (login)." );
mysql_select_db( 'mysql_database', $con )
or die ( "Error in Mysql connect (database)." );
$st="SELECT * FROM monitoring WHERE 1";
$value=mysql_query($st, $con);
if (mysql_num_rows($value)>0)
{
while ($one_row=mysql_fetch_row($value))
{
foreach ($one_row as $one_field)
echo $one_field."!";
}
}
else
echo "No result.";
? >


(mysql_user, password and mysql_database has to be replaced with the apropriate!
you need a "monitoring" table in the database with a "test" field and the value "OK" in it)

And the command line script on the windows machine:

wget URL_of_php_script.php
find "OK!" name_of_php_file.php
if not errorlevel 1 goto end
blat name_of_php_file.php -to your_email -server smtp_server -f from_email -subject "ALERT! Check your server!"
:end
del name_of_php_file.php


BLAT can be downloaded from: BLAT
WGET (for Windows) can be downloaded from: WGET

It just sends an e-mail, if there is any problem with your web server (or the hosting server of your page).

It can be also fine tuned to check if there is a problem with your internet connection, but you can start your monitoring with it. Just schedule the CMD script in a Windows computer!

Sunday, February 10, 2008

SBS 2003 migrating

You can migrate an OS in two ways:
1. install a new one and copy data, user information, software, etc. to the new one
2. copy the image of the installed OS to the new hardware, add necesary drivers

1. method:
Windows SBS 2003 has a built in backup, which backs up the "System state" to a file.
Sounds pretty cool. Just install a new Windows and restore System state!
Not so fast! System state includes all hardware information (and you do not have the option to exclude it!), so restoring it will destroy the new installation.

The official attitude:
How to move a Windows installation to different hardware

Microsoft does not support restoring a system state backup from one computer to a second computer of a different make, model, or hardware configuration.


So if you want to be prepared for a hardware failure, you better by two identical computers! There are small chances that you will be able to get an identical
computer after even a year!

2. method:
Migrating an OS, ideal solution:
- copy image of OS (resize partition if necesarry)
- boot with apropriate CD and install mass storage driver
- start OS on new hardware and install network driver
and other required drivers for optimal performance
- celebrate

Migration a Windows, theoratically:
- install new mass storage driver on old hardware
(since you cannot add mass storage driver on non-working windows afterwards)
- copy image, resize partition
- make sure you have a proper MBR and an active partition
- start Windows on new hardware and install network driver and other required drivers for optimal performance
- celebrate

Migration SBS, real life:
- install new mass storage driver on old hardware
(although it is no use, but you might be lucky)
- copy image, resize partition, and prepare yourself for a nightmare
- make sure you have a proper MBR and an active partition
- start Windows, you'll probably get a STOP error
- boot installation CD, run a repair installation and don't forget to press F6 at the proper time (you have about 3 seconds, than you have to reboot)
- repair installation: 40-60 minutes
- first time start of Windows: 2-3 hours
- reactivate windows
- now you only have to install SP1 and other patches
- probably reinstall Fax server, if you use
- also you might have to reinstall WSUS.

If you know an easier way, let me know!

Tuesday, October 30, 2007

Adobe Reader

Due to the latest security problem with Adobe Reader it asked for a permission to update. I agreed, so the installation went smoothly and without any problems.
But at the end IT DISPLAYED THE ADOBE READER !!X&@+!%# ICON ON MY DESKTOP AGAIN!

WHY? I never (I repeat, NEVER) start Adobe Reader directly, but with double clicking on a PDF file. Even if I wanted to start, I can easily find it in the start menu.

HOW DARE YOU MESS UP MY DESKTOP WITH A SECURITY UPDATE?

Please, please Adobe, stop putting you icon on the desktop!
I like my desktop clean!

Saturday, October 20, 2007

Exchange 2003 database limit

Although I increased the database limit of an Exchange 2003 server (as per: http://support.microsoft.com/kb/912375/), the database kept unmounting and I was getting 9689 errors in the event log:

Exchange store 'First Storage Group\Mailbox Store (SERVERNAME)': The logical size of this database (the logical size equals the physical size of the .edb file and the .stm file minus the logical free space in each) is 18 GB. This database size has exceeded the size limit of 18 GB.

If the logical size of this database is not reduced to less than the maximum size limit, this database will be dismounted the next time a database size check is performed.


I finally found the problem: the registry entry: Database Size Limit in Gb had an extra space in it!