How to delete a Windows volume mount point for an invalid drive
When I rebuilt my server earlier this year to run Windows 7 (rather than Windows Home Server), I decided to use Windows mount points to expand the storage rather than using separate drive letters or something like RAID to span disks.
The structure I use is similar to this:
C:\ - Backup - PCBackups - T510 - T60 - Server - Photos - Video - Data - Photos - Video
Each bold entry is a mount point – an empty directory on my C: drive to which I “mount” an external drive (using Windows Disk Management). So every bold entry above corresponds to a separate hard drive (indeed, it could relate to a specific partition on a drive with multiple partitions). Yes, I have a lot of hard drives in my server.
This means that, rather than accessing an additional drive in my server using a new drive letter, I can instead access it through a path such as C:\Data\Photos.
This gives incredible flexibility to add and remove drives – since you can easily change mount points, or use a new drive at a mount point if you run out of space. Any empty folder can be used as a mount point.
An example of this flexibility is from my PCBackups folder, where I store backup archives from my various laptops and computers. I created the C:\Backup\PCBackups folder on my system drive, then mounted a large hard drive at this point to give me plenty of space to store my backups. However, over time I eventually filled this drive and needed to expand the capacity. My laptop backups were taking the most space, so I renamed my laptop backup directory temporarily (C:\Backup\PCBackups\_T510), created a new empty folder (C:\Backup\PCBackups\T510) and then mounted another new drive at this point, greatly increasing the capacity of my PCBackups folder. I moved all the old T510 backups into the new folder, which moved them to the new drive, also freeing up space on the existing drive for other backups at the same time.
One of the nice things about this structure is that Windows remembers the mount points, so if you remove a drive temporarily – it will automatically remount the drive when it is reconnected.
The downside of this is that if your drive dies, or you remove it and use it else-where, the folder where the drive was mounted is not available for mounting of a new drive because Windows is still looking for the old drive to mount there.
Unfortunately, Windows Disk Management doesn’t give you any way of dealing with this – I had a drive die, but could not mount a replacement drive in its place because Windows was reserving that mount point for the old drive. I couldn’t connect the old drive to remove the mount point, because Windows no longer recognised the dead drive.
A bit of Googling found a simple solution – there is a command line tool (at least in Windows 7 – not sure about earlier versions), called “mountvol”, which allows you to manage volume mount points.
Using a command prompt running as Administrator (Start > All Programs > Accessories > right-click on Command Prompt and select “Run as administrator”), I was able to use the “/d” switch to remove a volume mount point from the folder where the dead drive was previously mounted, and then re-create the mount point for the replacement drive using Windows Disk Management. Easy as.
There are instructions on how to use Mountvol on the Microsoft TechNet site.
How to configure PEAR for Zend Server Community Edition on Windows 7
I decided to try running Zend Server CE (PHP v5.3) for my local development environment on my Windows 7 (64-bit) machine.
After discovering that I needed to explicitly choose to install MySQL and phpMyAdmin (simply fixed by running the installer again and modifying the installation), I found that the PEAR libraries some of my existing code relied on, was missing.
After a bit of research, I learned that I needed to run the PEAR installer:
C:\Program Files (x86)\Zend\ZendServer\bin\go-pear.bat
… however, this resulted in some very confusing error messages:
phar "C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\go-pear.phar" does not have a signature PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\go-pear.phar on line 1236
After a bit more Googling, I finally came across a suggestion on the PEAR blog: PHP 5.3 Windows and PEAR (go-pear.phar) | PEAR Blog
I ran the following command from the PEAR directory, which worked:
C:\Program Files (x86)\Zend\ZendServer\bin\PEAR>php -d phar.require_hash=0 go-pear.phar
… all that was then required was to follow the instructions (I needed to enter the path to the CLI php.exe, which is C:\Program Files (x86)\Zend\ZendServer\bin), and it worked.
How to convert scheduled tasks from Windows XP to Windows 7
When I decommissioned my Windows Home Server recently, I decided to replace it with Windows 7. However, I had over 20 scheduled tasks running on the WHS box to do things like back up my websites and backup files on the server and such.
I wanted to recreate these scheduled tasks on the new Windows 7 install, but discovered that Microsoft had changed the format for scheduled tasks in Win7 and provided no mechanism for importing the old .job files from Windows XP / Windows 2003. Windows 7 now uses XML files for import and exporting task definitions – but no conversion tool from the old .job format.
I really didn’t want to be spending the time manually recreating all of these tasks, but a bit of Google research found a possible solution involving remote invocation of the schtasks command line tool. Here’s what I did.
The first issue was that I had already decommissioned the WHS install, although I did save the C & D partitions on the system drive so I could have theoretically booted it up again. However, I had already changed some of the machine’s hardware (new MoBo, new SATA controller, etc), so that was always going to be a last resort and fraught with potential boot-up issues.
Fortunately I still had an old laptop running Windows XP, so I was able to copy the .job files I had backed up from the WHS box over to the XP machine and have them recognised by Task Scheduler there.
Next, I ran the following command on my Windows 7 laptop from an “elevated” command prompt (Start -> All Programs -> Accessories -> right mouse click on “Command Prompt” and select “Run as administrator”):
schtasks /Query /S remote_computer_name /U remote_username /P remote_password /XML > output_file.xml
… where the “remote_computer_name” was the name of my Windows XP machine, and “remote_username” and “remote_password” were for a valid administration user on that machine.
This command tells the remote machine to dump a list of all parameters for all scheduled tasks and send it to my console and the /XML flag tells the Windows 7 box to convert that information to the new XML format, and then I piped the output to a new file, “output_file.xml”.
The output was a concatenated list of all XML task data (which itself is not a valid file to import into Windows 7 task scheduler), so I used a text editor to copy and paste the individual tasks that I wanted to recreate and then used the “import” feature in Windows 7 task scheduler to import the new task. I believe there is a flag you can set to have the combined output XML for all the tasks be valid to import directly, but I didn’t try that, preferring to manually select which of the tasks to import and doing them one at a time so I could then check the settings each time.
There are a plethora of new features and settings in Windows 7 task scheduler, so it does pay to verify and tweak any settings after importing them. I really am quite impressed with the new functionality in Windows 7 task scheduler!
How to turn on/off Keyboard NumLock on bootup in Windows
I recently rebuilt my home server machine to run Windows 7.
I attached my ThinkPad USB Keyboard with TrackPoint to the machine (love these keyboards – the feel and usability of a ThinkPad keyboard on a desktop!!), but after setup, I found that I was having difficulty logging in with the username and password I had specified.
I did also notice at one point that I was getting strange characters when I typed, which I quickly realised was the NumLock on the keyboard being activated. Unfortunately, there is no NumLock indicator light on the keyboard (designed to be used with a ThinkPad, which displays NumLock status on the screen), so I couldn’t tell whether it was active or not.
A bit of experimentation at login and I found that the NumLock was being enabled by default on my new box – and a search of the BIOS settings didn’t turn up any options there for disabling it.
A quick Google search found some discussions about the issue, which identified a registry setting you can set to adjust this.
Steps to adjust:
A) run regedit
B) navigate to: HKEY_USERS\.Default\Control Panel\Keyboard
C) Adjust the value of InitialKeyboardIndicators to one of the following values:
0 – Turn all indicators Off (NumLock, CapsLock, ScrollLock)
1 – Turn CapsLock On
2 – Turn NumLock On
3 – Turn CapsLock and NumLock On
4 – Turn ScrollLock On
5 – Turn CapsLock and ScrollLock On
6 – Turn NumLock and ScrollLock On
7 – Turn all indicators On (NumLock, CapsLock, ScrollLock)
D) reboot
In my case, the registry entry was set to some high value, which seems to have triggered NumLock on. I reset it to 0 and it now works as expected – no NumLock at bootup.
Note that this entry can also be set on a per-user basis.
References:
NodeMobile Huawei E169 Error: “the device has been disconnected or is unavailable”
I’ve been using a Huawei E169 3G stick on my laptop to access Internode’s NodeMobile wireless broadband services for a while now. The other day I got an error saying “the device has been disconnected or is unavailable”.
I’ve seen this error before, sometimes the USB port gets a bit confused and unplugging and re-plugging the device, or moving it to a new USB port. I have also occasionally had to reboot the machine to get it working.
This time it just wouldn’t work – I rebooted several times, tried a few different things, but could not make it recognise the device.
I Googled the error message and came up with a blog from China: Huawei E169G the device has been disconnected or is unavailable error … which gave me some other ideas to try – specifically, reloading the drivers.
I found the drivers for my device in C:\Program Files\Wireless Broadband\Driver … I ran the DriverSetup.exe program and then tried again and it worked.
Hopefully this post helps someone else if they have problems with their Huawei E169 stick too!
Follow my Tweets