Wednesday, November 24, 2010

Error installing Veeam FastSCP

Veeam FastSCP is a stripped down version of Veeam's Backup and Replication for VMWARE. What is cool about both products is that you can Secure Copy between servers/folders. You can add Linux Servers to it and if you are using the Paid version, it does not count against licenses since the licenses are for VMWARE ESX and ESXi hosts.

I use the Free Version to copy files from my computers to and from VMWARE Hosts which is a real good thing if you ever tried moving files from your Windows Machine to the Storage of a VMWARE server without it.

Any ways, I have seen this now a couple of times and it only happens in Vista and Windows 7. When you are installing it, it will ask you for an account to start up the service, but when you give it an account, it will error out. It complains about the password and or account (sorry I did not get the error copied).

All you have to do is start the installation with administrator privileges. Right click on installer and "run as administrator" --- that is all.

Do not use an administrator account though. Create just a plain old account since all it needs it for is to start the service.

Delco

Thursday, November 18, 2010

Delay Starting Services with Batch File (Also use %errorlevel% and sc)

Recently I needed to delay starting up some services in Windows 2008 server. I had recently upgraded Veeam Backup and Replication from version 4 to version 5. When the server rebooted I found that for some reason three of the four of the services sort of hung. They said "starting" but would not finish starting. I found that if I started them up manually and started one at a time, they worked fine.

Now, I know that what I did is sort of a hack since the problem should not happen. Indeed after talking to Veeam tech support they said that they have never heard of the problem. Well, that still leaves me with a somewhat working system. I need it to work now, and then, I will try to scour for what the actual problem is. I could not leave it on manual because it would be easy to forget to start them up.

I needed to delay the start of the services, and stagger them so they would each start individually one after each other. There a few ways to delay start up of services. One is to create a dependency on another service. Another is to use a program that does that-the third for me was to write a script. I chose to write a script.

For my script to work, I needed another little utility: sleep.exe which is part of the Windows 2003 Resource kit.

Let's dissect it a bit. I am adding line numbers for easier reference, you would not have these line numbers.


* The first two lines are just comments
1. REM 1. VeeamNfsSvc - Veeam vPower NFS Service
2. REM Checking Service State

* Line 3 is very important. SC is a command line program used for communicating with the
Service Control Manager and services. If you want to find more about it in a command line window, just type sc /?.

*"sc" is the command. "query" is the command. In this case it says "look for". "VeeamNfsSvc" is the service name. "|" This is the Pipe. Pipe funnels the result to another command. In this case the "find" command. We are looking for the results of the query that has the text "STATE" in it, and we do it again and look for "RUNNING". The "> nul" redirects what you would normally see in the screen to nowhere. You will not see it. It is a dead end.

* A summary is look for a service called VeeamNfsSvc with the STATE of RUNNING (as opposed to STOPPED).

3. sc query VeeamNfsSvc | FIND "STATE" | FIND "RUNNING" > nul

* Lines 4 and 5. OK, this is decission time. When "sc" gets done it sets an exit code on the system if it was the code is 1 jump to label ":vPower_not_running. If it is 0, then jump to label "Veeam_Backup.

4. if %ERRORLEVEL% == 1 GOTO :vPower_no_running
5. if %ERRORLEVEL% == 0 GOTO :Veeam_Backup

* Line 6 through 9: Line 6 the label. Line 7 print message to screen. Line 8 uses sleep.exe to wait for 30 seconds. Then line 9 starts the service. Line 10 jumps to the next Label to test and start the next service if needed.

6. :vPower_no_running
7. echo Starting VeeamNfsSvc
8. sleep.exe 30
9. NET START VeeamNfsSvc
10.GOTO :Veeam_Backup

After this I went through each service doing the same thing. Four total services. To wrap the whole thing up, I added an Scheduled Task in Winodows Scheduler to start this script (which I saved as a *.bat file) at start up with administrator account. Also made sure that it runs whether the user is logged in or not. Why? Because if I reboot and I don't log in, it will still run and have the services started.

Delco

Saturday, November 13, 2010

Shrinking Windows 7 Physical System Disk

A while ago I blogged about how easy it is now to expand a Windows 7 or Server 2008 system disk, but try shrinking it. Well, let me rephrase that, it is easy now to shrink a system disk with Windows 7-but, not shrinking it to the size I wanted.

After I expanded the disk, I realized that I wanted to clone the hard disk to a smaller disk so I could use the larger disk to install Windows 7 64bit and still have my old disk in case I needed it.

My plan was to use Windows Home Server recovery cd to take a recent backup and put it on the smaller, but here is another techbyte: Windows Home Server cannot resize into a smaller disk even if you have a lot of un-used space! I needed a smaller size so I could do that.

Back to shrinking. In Windows 7 you can now shrink a disk. I have a disk approxametly 465gb with only about 65gb being used. I want to make it 215gb big. The first time I tried shrinking with Windows 7 this is what happened:

1. In Computer management, go to Disk Management.
2. Right Click the disk you want to shrink, and select shrink.
3. After an analysis, it comes back telling how much you can shrink the disk by, it told me I could only shrink it by 17gb! The problem is, that if you have a file that cannot be moved, it blocks you from actually shrinking by the amount you want. Here is the message in the application log:

A volume shrink analysis was initiated on volume (C:). This event log entry details information about the last unmovable file that could limit the maximum number of reclaimable bytes.

Diagnostic details:
- The last unmovable file appears to be: \Windows\SoftwareDistribution\DataStore\DataStore.edb::$DATA
- The last cluster of the file is: 0x700aa55
- Shrink potential target (LCN address): 0x12035b2
- The NTFS file flags are: ----D
- Shrink phase:

To find more details about this file please use the "fsutil volume querycluster \\?\Volume{efa59fe1-bcbc-11de-89e4-806e6f6e6963} 0x700aa55" command.

4. I stopped the Windows Update Service and deleted the Datastore folder which allowed me then to shrink the disk even more, but only by 34gb. So I thought, well I will run it twice, but then my Blackberry software was blocking it.

5. Back to the old school. I used GPARTED.

See the following Screenshots:


Selecting the Shrink Option


Analyzing the disk


Results only allow 17gb of shrinking


Based on information in Windows Log, I deleted the storage folder and Re-ran the analysis.


After running the Shrink Option, I now shrank by 34gb. This is way short of what I want.


This is where I ran a second analysis, and I still could not shrink the disk anymore. Now my Blackberry Software could not be moved.


Here is the GPARTED process running on my disk.


So I ran GParted to get the results I wanted.

Ok, so now I have the disk the size I want. Now I am going to try to back it up and restore it with Windows Home server restore to a smaller disk. Oh, by the way, I love Windows Home Server but it sucks that it cannot resize to smaller partitions like Ghost or Accronis, or as you can see GPARTED.

Windows has made great inroads in giving us the tools to resize the disks. Now that we can increase the system drive on the fly! We can also shrink the system disk, but I find it still limiting. Don't get rid of the third party tools yet.

Delco

PS: I ran Diskeeper to see if I could move the folders and files to the front but did not work for me.

Also see following links:
How to shrink Windows 7 disk
Download GPARTED

Tuesday, November 9, 2010

Extending the C: Partition in Windows 7

The cool thing about Windows Server 2008 is the feature to be able to extend the system partition (make it bigger). So if you have a disk partitioned that includes the c: drive but you still have free disk space that has not yet been allocated, you can add that to the c: drive.

This is something you could not do before. Believe me as a server administrator, not being able to do this in the past was a huge deal. This was especially true in the bad old days of nothing but physical servers. If your system disk filled up, your only choice is to somehow replace it with a bigger one.

In the virtual world it became a bit easier since you could make the virtual disk larger, but you still could not extend it with diskpart as you could a non-system disk. You could still extend it with Gparted or linking to another OS as second disk and extending there.

See:
Increase size of C in VMWare
Expanding virtual disk with VMWorkstation
Increase size of system disk part 1
Increase size of system disk part 2

But now whether physical or virtual, you can extend a system disk with diskpart on the fly with no downtime at all-very cool! Now of course you can do it with Windows 7.

1. To do so, just start a Command Prompt with Administrator rights.
2. Type Diskpart and hit Enter
3. Type list volumes
4. Select the c: drive volume --- like sel vol 3
5. I like to do list volumes again and make sure I selected the right one. Look for the one with the Astrix in front of it.
6. Type Extend
7. If successful, you will see message "Diskpart successfully extended the volume".

Go back and check the new size of your disk.

Very cool!

Delco

Remove Ubuntu and Grub from dual boot with Windows 7

I found this very easy.

I had set up my laptop to dual boot between Windows 7 32 bit Ultimate and Ubuntu 9.x 32 bit. The way I set it up was to first install Windows 7 first, then Ubuntu. In this way I replaced the Windows 7 boot loader with Grub.

I ran my laptop for a year like this but lately I wanted to change it up a bit. I want to run all 64bit both Windows and Ubuntu. Yet, I do not want to lose my Windows 7 Configuration because I had made that my primary boot and used it extensively and had a lot of personal software on it. I wanted to move my current Windows install to a smaller hard drive, and then use my larger faster hard drive for 64 Windows. I had a hard time cloning the Windows partition to another drive because of Grub and Ubuntu.

I decided I wanted to get rid of Ubuntu so I would be left with just Windows and that should be easily cloned to another hard drive, or use my Windows Server backup and restore to move it to a smaller hard drive.

Steps to remove Ubuntu and Grub:

1. In Computer Management, then Disk Manager, select the Ubuntu partition and delete it.
2. Boot with your original Windows 7 installation Disk.
3. Select Repair, and get to the menu where you can select the Command Prompt.
4. Type bootrec.exe /FixMbr
5. Reboot.

NOTE: Step 4 above. The first time I used bootrec.exe /FixBoot ... this still did not work and Grub was there so I rebooted with the Windows 7 install disk, and used the /FixMbr. I belive just selecting /FixMbr should work, I did not have opportunity to select it first so if you have any problems, use /FixBoot first, the /FixMbr.

Delco