Tuesday, December 16, 2008

Shutdown without powering off.

Have you ever needed to shut down your PC, but wanted it to stay powered-on for some reason?

In my case, I have a power outage scheduled at a remote location—the power company is going to kill the power to do utility work for about 4 hours—and I really don't want to drive out to the remote location just to turn the server back on.

What I'd prefer to do is use remote access to put the server in a state that is "safe" for the operating system (i.e., I/O is flushed and volumes are clean dismounted), but it is still "on" so that when the power comes back on after being off for a while, the server will happily reboot.

Mind you: I have this server on a UPS, so its power won't fail until the UPS is fairly well depleted and shuts itself off; it won't power back on until the UPS has recharged enough to keep the server running for 20+ minutes. This will eliminate issues with the power company flipping things on-and-off while doing their work, as well as the very good potential for a surge when they finally get things turned back up.

Of course, this could have all been avoided if I had the BIOS set to power-on the server on whenever the power state switches from OFF to ON. However, there are any number of reasons why it's not currently set this way, and resetting it would require two things: driving to the remote site (which I want to avoid) and scheduling an outage because there's no way to edit this particular BIOS setting via administrative software (too bad, eh?). In some ways, resetting the BIOS is a worse option than what I'm after.

So what's the trick?

  1. You have to enable a policy for the system
  2. Use software (not the START button) to initiate the shutdown.

One can enable the policy in several ways, but the end result is the following registry key being set:
System Key: HKLM\SOFTWARE\Policies\Microsoft\Windows NT
Value Name: DontPowerOffAfterShutdown
Data Type: REG_DWORD
Value Data: 1 (0 = power off, 1 = stay on)
This policy is only observed when software is used to perform the shutdown (like UPS management software, which we haven't got for our server, as the UPS is an old horse without a modern USB interface. Yeah, I know: it also means that the UPS doesn't properly shutdown the system during unplanned outages, but that's an issue for another day...). If you use the START button/Taskbar to perform a shutdown (which is the typical method for a planned/expected shutdown), it will ignore the setting and power down after shutdown.

Personally, I'll be using "shutdown -s -t5" to shutdown 5 seconds after the command is issued.

Other caveats: this policy only works for Windows OSes after XP SP1, and there are known issues with some Pre-SP1 Windows 2003 servers (see Microsoft KB 819760 for more details on that) that might not result in success.

Friday, February 8, 2008

Built-in "Administrator" account disabled by default

If you haven't seen this one before, be aware: with Vista, the built-in Administrator account is disabled by default.

When you install Vista (in any flavor: 32/64-bit, home, business, ultimate or enterprise), the first account that is created gets put into the local Administrators group; subsequently added accounts are created as limited users unless otherwise specified.

This leaves for an amusing little scenario (not):
  1. Install Vista
  2. Add machine to a Domain
  3. Log in to Vista using a Domain Admin account (giving administrative privileges on the machine)
  4. Delete the (admin) user created during install
  5. Dis-join from the Domain
You now have a PC that cannot be logged into using the local accounts (both the default built-in accounts are disabled) or the domain account (the PC isn't in the domain anymore, so there's no trust relationship). Vista will happily present to you the domain account for authentication, but you can't get it to authenticate. Attempting to use the local Administrator account will fail; after all, the account is disabled.

Luckily, the folks on the Vista team recognized this possibility. The fix is to restart in Safe Mode (hold down F8 during POST). Vista will boot into the Safe Mode GUI using the built-in Administrator account, even though it is disabled. From there, you can enable the Administrator account, reboot, then log in "normally" to re-join the domain.

You can also shorten the process by using "Safe Mode with Networking" to re-join the domain (whether you enable the Administrator account or not).

If you enable the local Administrator account using this process, it does remain enabled, even after rejoining the domain.

Tuesday, January 22, 2008

Vista RIP Listener

You can find plenty of posts out there on the way to add a RIP Listener to Vista (For sake of completeness: use the "Programs and Settings/Windows Features" to install it).

I'm writing about this because I had a specific need for the listener: I needed to troubleshoot some RIP publishing problems for our remote clients—clients that connect using XP's PPTP VPN capacity. Those clients use the XP RIP Listener, and I needed to be sure that changes being made to the RIP controls in the central VPN router weren't affecting those clients.

Well, I didn't have access to a remote system running XP, but I had remote access to my Vista machine (thanks to LogMeIn). I configured the VPN and added the RIP listener, but no route updates were being received.


So I fooled around with the Vista firewall, thinking that Port 520 might be blocked, but there was no joy.

Finally, I pulled up SysInternal's Process Explorer to make sure that the listener was running. Sure enough, the RIP Listener wasn't running under any of the svchost.exe instances. It dawned on my to look in the Services control panel, and lo, although it was set to run "automatically", it hadn't been started upon install.

I started it, and within 30 seconds, all the remote routes were in the routing table as desired.

I made the updates to the VPN router, saw my changes didn't break anything on my remote Vista box, and closed the case that started the whole thing.

Tuesday, January 15, 2008

PartitionMagic it isn't

In my previous post, I gave the story of how I went from a pair of 320GB RAID1 volumes to a single 750GB RAID1 volume. While that post wasn't very Vista-specific, it set the stage for this post: how I used the additional space.

Since I acquired my first iPod, I've been creating a separate, un-named NTFS volume, which I would then mount on the system (C:) partition; after doing that, I would use TweakUI (on XP) to point the "My Music" virtual folder to the mounted volume. With this technique, I have been able to constrain the space consumed by my iTunes library in line with the space available on my iPod. Having started with a 40GB "third gen" and later upgrading to the 60GB "iPod with Video", I've had to resize the volume, but it otherwise works very nicely.

And by having a separate volume, it's really easy to segregate the backup of the system versus data partitions.

When I rebuilt the RAID-0/1 into 2x RAID-1, I didn't "carve out" a 60GB chunk for the iTunes from the first RAID-1 set: as it was, I was having to deal with 2x 320GB virtual volumes, and carving the first one into 64GB for Vista, 60GB for music and the remainder for ?. I had the other 320GB for data, so I just gave up: the first 320 volume kept the 64GB Vista partition, and the remainder was mounted as my iTunes store. Lots of wasted space, but it kept the drive letters the same.

But with my reconfig, I'm back to a single volume to carve up as desired. I already had the 64GB Vista partition the way I wanted it, but now I had a 200+ GB NTFS volume where I really only wanted a 60GB. PartitionMagic was out; although I have a licensed copy, it only behaves on my system when run under NTLDR and the nVidia RAID driver is properly loaded.

So, I decided to play with the new Vista drive manager option for shrinking a volume.

Turns out, it works very well. Select a volume to shrink, right-click and select "shrink volume..." The dialog that follows will let you know the maximum space that can be recovered from the volume. Adjust to your desired amount, and click the "Shrink" button.

There are a some major limitations to the tool, however:
  • Disk Manager will only truncate space from the last bit of data to the end of the volume. You'll definitely want to run defrag to get as much data shoved to the front of the drive as possible before running.
  • Even if you have an empty volume, you may find you can't shrink the volume by more than half the empty space. That's because the normal place for the NTFS MFT is the "middle" of the volume. The only way to reclaim more space is to run a boot-time defragger that can re-optimize the location of the MFT: once you truncate all the space possible, the MFT is left at the end of the drive. The boot-time defrag will move the MFT to the "middle" of the new volume, creating another large slack space that can be used to shrink the volume. Personally, I use Raxco's PerfectDisk 8 Pro.
  • Disk Manager cannot move a partition to consolidate free space, so plan out your partition layout before you start shrinking and moving things around.
So I ended up using two passes to shrink the iTunes volume to 80GB (yes, I'm considering another upgrade), followed by creating a new NTFS volume to use the remainder of the space.

I copied some of the stuff I wanted on fast storage from the drobo, and now I'm sitting pretty with the new setup.

Monday, January 14, 2008

Playing with drobo

Okay, I'm a sucker for certain gizmos. I am now the proud owner of not one, but two Data Robotics "drobo" external storage devices.

I bought the first one from Dell for $409 +s/h. That's almost $100 off the current list price that everyone else posts. I picked up a pair of 750GB Western Digital drives from NewEgg, the Caviar SE16 WD7500AAKS. These drives are 7200RPM, 3.0Gb/s SATA Drives with a 3-year OEM warranty. Nice. With the >650GB of protected storage, I've been able to move a bunch of home video from tape (Digital8) to best-quality AVI on the drobo.

As a reward for purchase and registering the drobo, DataRobotics offered me another one for $299.

I couldn't resist.

I bought the second one along with another pair of the WD drives, and was prepared to be in storage nirvana before the end of the year.

But fate had different ideas...

One of the two new drives was DOA. The drobo failed it, and when I attached it to a USB dongle and tried to get it to work as a plain drive on my desktop, it also failed. Oh well, time to get the drive back to NewEgg for a replacement.

Yechh. 25% out-of-box failure rate on these drives. Good thing I'm using them in a protected storage array!

Anyway, by the time the replacement drive arrived and I got the drobo installed on my Vista system, it was 10 days into the new year.

And this is where things get to the point. My Vista machine is running four 320GB drives in a pair of RAID-1 volumes; I'm not using RAID-0/1 because of issues with the drivers and chipset, and I was wasting quite a bit of space in that configuration.

So I had the clever idea: swap the 4x320GB drives in my machine for the 2x750GB drives in the drobo.

I started by moving all the data in the second RAID-1 array to the drobo.

When that was done, I deleted the volume in Vista, removed the 2 drives for that array from my system, installed them in the drobo, and waited for it to incorporate the drives.

Then I swapped one of the new 750GB drives in the drobo for one of the remaining 320GB drives in the PC. Both the PC and the drobo went into 'degraded state' while the arrays were rebuilt with the swapped spindles, but everything eventually 'went green.'

Again, I swapped a 750GB in the drobo for a 320GB in the PC. Again, I went through the process of having the arrays rebuild themselves. Finally, I had to delete the 320GB RAID1 volume on the PC and create the 750GB volume without clearing the data in order to get the PC to use the entire space available on the new drives.

I now have a nearly 1TB storage volume on my drobo, coupled with a 750GB RAID-1 volume with my Vista installation on it. Now it's time to redo the volumes in Vista to take advantage of the additional space...