Archive for the Windows Category

I got excited a while back about pivot. There is a PivotViewer control available in VS2012. Ooh a bit more excited.

Some links here for me to get some guidance:

* A gentle introduction to the semantic zoom pivot viewer in LightSwitch
* Extending the LightSwitch pivotviewer with colored cards and slider based numeric filtering
* Adding semantic zoom to the LightSwitch pivot viewer
* Adding in the LightSwitch pivot viewer an adorner for communicating with the regular lightswitch screens
* Semantic zoom with pivot viewer – a sample application

My windows PC died a nasty death the other day. File System failures, BSOD’s. Generally not pretty.

I’ve been using Ubuntu 12.04 LTS running from a USB live installation to get access to the internet and local files that weren’t hosed (and to do some HDD recovery work). I am pretty happy with Ubuntu as the main OS at the moment, and think I will stick with it as the primary OS and keep a Windows 7 OS mainly for gaming (BF3 / SC2).

This is a log of some of the the troublesome items I’ve come across while migrating to a dual boot Ubuntu 12.04.1/Windows 7 SP1 setup.

“Windows cannot be installed on this disk”: I could not get an install of Windows to work. It would hang immediately after the four windows balls appeared. I unplugged every USB device, then eventually every other hard drive until I just had one small SSD connected. (Ubuntu live installation was fine though – which led me to believe it was not a hardware (RAM, mobo etc issue). I turned on AHCI in the BIOS settings and all of a sudden the Win7 installation recognised the disk. The installation of Win7-SP1 went fine – until I added some data drives. Boom! No boot for you! I had to head back to the BIOS to turn AHCI off to get windows to boot if other drives were plugged in. I still don’t know what is going on with this motherboard, Win7, and multiple HDD’s – but it works now.

Multiboot: I have set up Windows 7 to be totally oblivious of the Ubuntu installation. The OS’s are installed on different disks, with the Ubuntu disk being pointed to as the primary disk in BIOS, and the Ubuntu grub2 bootloader chainloading the Win7 bootloader.

Hard drive forensics: Whilst cleaning up the data drive I realised I could collapse the partitions on one of my data drives into one big partition. In Windows disk management console I right clicked on the first partition – deleted it, and asked the OS to extend the latter partition to fill that space that was previously the first partition. What actually happened was Windows still kept the two logical partitions, and using “dynamic disks”  (aka JBOD) functionality to pretend it was one big partition. This was not what I wanted so I right clicked on the first partition and asked it to delete the partition so I could try alternatives to get the disk to be one large partition. What I ended up doing was deleting both partitions! Uh Oh. Family Pics and years of other data gone – it’s all backed up on the cloud, and other storage, but the idea of downloading several hundred  gigabytes did not make me smile. I fired up TestDisk in Ubuntu and all was OK. After a few minutes I had identified the files/directories I wanted to recover and copied them off the drive I had just hosed.

Rebuild partitions: GParted. Best partition management tool ever. Lets you review what you are going to do before doing it. (Looking at you Win7 disk management console!)

Replacements for my Win 7 applications:

  1. Text Editor: Notepad++: Geany via Ubuntu Software Centre
  2. Password Safe: KeePass2: available via Ubuntu Software Centre
  3. Music File Tagging:
  4. File Sync: DropBox: available via Ubuntu Software Centre but throws an error – “Dropbox is running from an unsupported location”. Uninstall dropbox via Ubuntu Software Centre then visit to download and install the latest deb package.
  5. E-Book Management: Calibre: Calibre available via Ubuntu Software Centre
  6. uTorrent: You can install Deluge via this link
  7. DVDShrink: k9copy from the Ubuntu Software Centre
  8. Desktop widgets: Conky
    • Ubuntu 12.04 comes packaged with conky version 1.8.something (which has some bugs with graps default sizes not working)
    • to get latest version of conky I went here and grabbed the latest conky.
  9. Backups: Crashplan. Migrating to Linux I lost all the history of my backups. I am backing up my files to wifey’s PC, file server and two external usb hdd’s that I take into to work every couple of weeks. On my old windows machine I used junction points to trick crashplan into backing up to my file server. I have to learn how to mount network shares to get that happening again.
  10. Internode usage widget:
    1. Used a script to check my usage stats.
    2. Used crontab to create a cronjob to call the stats script every half-hour
    3. Put some lines into conky to display the  results on the desktop

Things stopping me from totally moving from Windows:

  1. Battlefield 3: This one stays on the windows partition
  2. Ember Media Manager: A great nfo, cover and fanart scraper for films and TV shows. I have not yet found a scraper that does a similar job, that can create file-based data stores for my xbmc stash.

Change host name: I didn’t like the computer name I assigned during installation. To update it via command line (Press Ctrl + Alt + T to launch a terminal windows)  >sudo geany /etc/hostname then reboot.

Change file permissions from root to nobody: When I used TestDisk to recover all the files from the hosed data drive it was done as root. As a result I didn’t own the files (root user did). TO change the permissions so I can delete and move files around I had to:

  • Open a terminal (Ctrl + Alt + T)
  • > sudo -i
  • > gksudo nautilus
  • right-click the directory > properties > permissions > select owner:nobody read/write; group:nogroup read/write; others:read/write; Apply permissions to enclosed files

Change Nautilus file explorer to default to list view: summarises it well. Open Nautilis > Edit > Preferences > Views > List View

Directory comparison when restoring hosed files: KDiff3 from the Ubuntu Software Centre

Auto-mount my NTFS data drive: I’ve got some data that I’d like to share between Ubuntu and Windows. Web browser and email client profiles, plus some family pics etc. I followed the instructions I found

  • here: locate drive details and update fstab with HDD UUID, and give permissions to me to have read/write permissions on the mount point, and
  • here: remount all drives found in fstab without rebooting

Keyboard and mouse not recognised: Garr. Messed around with the display settings to get dual screens and had to reboot to get it recognised. Now suffering with a strange bug detailed here. My USB keyboard and mouse are recognised in BIOS, Grub2 but not recognised when the ubuntu login screen kicks in. If I wait a while (83 seconds) they seem to come live again…

  • I am going to try replacing the display manager as described on this page. Replacing LightDM with GDM -> same result.
  • Grrr – no luck so far
  • [Update:29 Sep 2012] The Good: It’s fixed. Keyboard and mouse now operating normally. The Bad: I have no idea why. A few updates; a few reboots… :-/ I think it was just from disconnecting teh kb/mouse from the front usb ports and using the rear ports.

Install Google Earth:

  • Google Earth is not in the Ubuntu Software Centre – download the deb file from here (64-bit .deb), save it to your desktop and double click it, which will launch the software centre and install Google Earth.
  • You are supposed to launch the application every time by firing up a shell and typing “google-earth“, but I’ve created a desktop shortcut for it…
  • install gnome-panel by firing up a shell and typing sudo apt-get install gnome-panel
  • You can then type gnome-desktop-item-edit Desktop –create-new to launch the gnome desktop shortcut creator
  • Then create a link with Name:Google Earth; Command: /usr/bin/google-earth

Setup dual monitors: lots of messing around with system settings within displays section led nowhere. Was  getting errors like this: “required virtual size does not fit available size: requested=(3600, 1080), minimum=(320, 200), maximum=(1680, 1050)” Eventually found from here that sudo amdcccle fires up the AMD Catalyst Control Centre. From the CCC I could set up dual displays to act as one large monitor. A few reboots and all was good.


  • Mount network share as read-write for backup (crashplan) purposes. This looks helpful.
  • Rsync: Learn how to use this to replace my Windows xcopy backup and migration scripts.
  • Conky: Currently flashing, irrespective of double-buffering settings in .conkyrc. Might have something to do with next two problems.
  • Unity 3D currently reverting to 2D even when I select Unity in the login screen. Something to do with Xinerama, RANDR, amdcccle. I no longer have compiz doing anything special. No wobbly windows, flaming windows etc
  • Xorg: learn how to configure this in 12.04 as one no longer directly configures xorg.conf anymore.

I was installing win7 on wifey’s new PC yesterday but the CD had been damaged.

I still had the Win7 iso file. I figured if I could dump them all onto a USB thumb-drive to install.

Found instruction here to make the USB bootable:

I grabbed the beta for Battlefield 3 the other day. The installation complained about the out-of-date graphics drivers, but I went to install them nothing worked.

Solution here:

A while ago I got excited about booting Windows 7 using Virtual Hard Drives as the boot media. I have always thought it would be great if I could use differencing disks so I could:

  • create new instances of OS’s super-fast
  • back up changed environments but only have to copy the differences (as opposed to moving 30+ Gigabyte files around the network.

I found a post from the folks over at lost techies that talked about how easy it is to set up a system that boots from VHD’s that are children of other VHD’s.

  1. Set up a “base” VHD
  2. Open an administrative console session:
    • > diskpart
    • > create vdisk file=”C:\vhd\starcraft.vhd” parent=”C:\vhd\win7base.vhd”
  3. I use some tools from NeoSmart Technologies like EasyBCD to put the diff disks as an option in your bootup sequence in your boot menu and – tada booting from a VHD diff disk

Most linux fiends will cry “WHY?” but I think if it makes more wife-friendly than it’s a good thing…

I thought it would be a breeze to create a differencing disk with VPC 2007.

I imagined the process to be:

  1. Create a virtual PC to be used as the parent for all images.
  2. Install <Operating System> onto the virtual PC.
  3. Create new virtual PC – create a virtual disk of type “difference”, and point it to the parent as it’s starting point.

Nope – it does not happen that way. It’s quite a convoluted process.

Luckily the folk at have already figured it all out.

Good work with simple instructions that are easy to follow. So easy, in fact, that I have myself a system where I can try out new ideas that are likely to mess up my PC – without messing up my PC.

I can create a new PC in probably less than a minute now. I can then do all the dodgy stuff I would never dream of doing on my own PC, without having to worry about it. Things like opening unverified executables, installing software I intend to use only once, testing a variety of software…


Here is the text from the previously mentioned link (just in case it goes down)

Step #1 – Create and install the base image VM

Without going into great detail here, create a new VM by specifying the name of the VM, the location of the virtual hard disk and the .VMC file, select the type of operating system you’re going to install, and allocate the right amount of memory to the VM. You can read more about creating virtual machines in Microsoft Virtual PC 2007 on my “Creating Virtual Machines with Microsoft Virtual PC 2007″ article .

After creating the VM you need to boot it, and install the required operating system on it. The installation process is as smooth as installing the OS on a real computer, and is only a notch slower (based upon your host’s machine hardware specifications.

If the OS requires entry of a CD-Key (or Product Key) – do it. If not (like Windows Vista), you can leave it to a later phase.

Make sure you install all the relevant components. Also, you might want to leave the ISO image for the installation CD available on the network in order to allow for future additions of OS components. In order to keep the virtual disk as small as possible I try not to copy the i386 (or equivalent) installation folder to the VM.

Step #2 – Customize the base image VM

In this step you will want to customize the base image VM as you want it to appear in all subsequent clones of that VM. For instance, install any file, tweak, addition, program, tool or other item that you want to have on ALL the VMs that are based upon this base VM.

If you plan to clone the base VM many times and you plan to have these machines on the same network (for example when creating an Active Directory-based lab of several servers and a few client machines) do NOT activate the base VM!

If all subsequent clones will work independently from one another (for example when creating a lab of one Windows XP Pro SP2 machine that will have several applications installed on it but none will work together at the same time or will not be part of the same AD domain) then you can activate the base VM.

Remember, cloning VMs is like “ghosting” a real machine. You must use SYSPREP in order to create unique SIDs, computer names and other settings for each cloned machine.

Read the Links section for more info on SYSPREP.

Also, note that you should install the VM Additions on the base VM.

Step #3 – Temporarily enable undo disks for the base image VM

Next comes the nice part. After customizing the base image you need to shut down the base VM. Make sure you do NOT perform the following step unless you are 100% sure that the current state of the base VM is EXACTLY like you want it to be cloned. You will NOT be able to easily modify the base VM AFTER you’re created differencing disks of it, so pay close attention.

In the Microsoft Virtual PC console, click on the Settings button for the base image VM. Click on the Enable Undo Disks checkbox and click Ok.

At this moment you should have 2 files in the base VM’s folder. A VHD file for the virtual disk, and a VMC file for the VM settings.

Step #4 – Boot the base image VM once and quickly shutdown without committing changes

Now you need to boot the base image VM once. Let it boot all the way, log on to the OS if you want to.

If the base image cannot be booted “all the way”, because, for example, you’ve got a SYSPREP unattended script waiting for the cloned machines to be booted and you’d like to keep it that way, do NOT boot it “all the way”, and instead just let the VM boot for a few seconds. When either the logon page has appeared, or you think enough time has passed (and a few seconds is all you need), close the base VM by closing the Virtual PC window for the VM.

Make sure you select Turn Off and Save Changes from the drop-down list, and UNSELECT the Commit Changes to the Hard Disk checkbox. Now press Ok.

If you look at the base VM’s folder you will see 3 files. A VHD file for the virtual disk, a VMC file for the VM settings, and a VUD file for the undo disk. The VUD file is probably very small, but fear not, it will not remain so for long.

Step #5 – Rename the undo disk

Now we need to rename the VUD undo disk to whatever the new cloned hard disk will be called, and change the file type to VHD. Click on the VUD file and either right-click and select Rename or press F2.

Now you have a (small) new VHD that is linked to the base virtual hard disk of the base VM.

You can also copy the original VMC file, or, if you want to, you can create a new one in step #7.

Step #6 – Disable undo disks for the base image VM

Now we need to disable the Undo Disk feature for the base VM. In the Microsoft Virtual PC console, click on the Settings button for the base image VM. Click to UNSELECT the Enable Undo Disks checkbox and click Ok.

Note: You must never re-boot the base VM. If you do so, you might ruin all the differencing disks that are related to it.

Step #7 – Delete the base VM from the Virtual PC console

Since you are not allowed to ever reboot the base VM you can simply delete it from the list of VMs in the Virtual PC console.

Step #8 – Configure the base VM hard disk to be read only

Open Windows Explorer, right-click on the original VHD file, and select Read Only. Press Ok.

Step #9 – Create a new VM by using the renamed undo disk of the base image VM

Now we can create as many new VMs from the cloned VUD file that we renamed in step #5. You can copy that file as many times as you want, and for each time you copy it you can create a VM out of it. Follow the steps outlined in my “Creating Virtual Machines with Microsoft Virtual PC 2007″ article.

Note: Remember the SYSPREP issues mentioned in step #2. Any cloned machine that you want to place on the same network as other cloned machines must be SYSPREPed. Note: The cloned VM hard disks can have Undo Disks enabled on them, if you so please. Note: Remember, you will (probably) need to activate each cloned machine, unless you’re using an OS that does not require activation or has a VLK license. Finally, when you boot your cloned machines they work normally, and when you close them they save their changes to the differencing virtual hard disk that uses the now-unchanged base VM hard disk.

Now that I have installed winXP I think it’s time to back it up.


~$ sudo time dd if=/dev/hda1 ibs=4096 | bzip2 -v --fast | split -a 2 -b 1024m - winxpsp2.img-part-

[Verify backup files]
~$ md5sum /dev/hda1

~$ cat winxpsp2.img-part-* | bunzip2 | md5sum

~$ sudo time cat winxpsp2.img-part-* | bunzip2 | dd of=/dev/hda1


The dd command seems to be the way to go, but it backs up empty space as well, so I am using the compression tool bzip2 to ensure I don’t waste too much space. I’ll be storing the backup files on my network file server share.

First I’ll have to mount my file server shared directory:
~$ sudo mkdir /media/fileserver
~$ sudo mount -t smbfs //server01/shared /media/fileserver -o username=WindowsUserName,password=WindowsPassword

This command failed with the following error (grrr):
smbfs: mount_data version 1919251317 is not supported

After a quick google session I found that it means the smbfs package is not installed. I installed smbfs via: sudo apt-get install smbfs then executed this again:
~$ sudo mount -t smbfs //server01/shared /media/fileserver -o username=WindowsUserName,password=WindowsPassword

Now we are ready to backup not just the windows installation, but the entire partition that it is installed on.

The command to back up the partition is:
~$ sudo time dd if=/dev/hda1 ibs=4096 | bzip2 -v --fast | split -a 2 -b 1024m - winxpsp2.img-part-

Where sudo time dd if=/dev/hda1 ibs=4096 means:

sudo Super user do. That is, do the following command as the root user.
time Report how long the commands took
dd Disk Dump (as far as I know)
if In file
/dev/hda1 A reference to the partition that has windows on it
ibs Input byte size. That is, read 4096 bytes at a time

The results of the above commands are then piped into the bzip2 compression tool where bzip2 -v --fast means:

bzip2 Name of compression program
-v Do verbose logging (a bit pointless when piping – it really shouldn’t be there)
–fast Do fast compression. basically means it’s compressing smaller block sizes, which leads to sub-optimal compression. 7.5GB is still going to take about 2 hours on my AMD 2500+ CPU

The output of the compression tool is then piped (yet again) to a tool called split that splits large files into smaller ones. It uses the following syntax split -a 2 -b 1024m - winxpsp2.img-part- where:

split Name of splitting program
-a 2 The number indicates how many suffixes to use in the output file name. Say I split a large file into 3 pieces. I can use -a 1 to give me three files called filea, fileb and fileb. Using -a 2 would result in three files called fileaa, fileab and fileac.
-b 1024m Indicates the maximum size of each split output file – in this case 1024MB (1 gigabyte)
– winxpsp2.img-part-: The first dash means read from standard input (or piped input – same thing really). Usually you could put the name of a file to split. The ‘winxpsp2.img-part-‘ bit means to name each file winxpsp2.img-part- followed by the specified amount of suffices. In this case winxpsp2.img-part-aa, winxpsp2.img-part-ab, … winxpsp2.img-part-ah.

Eventually I guess I’ll do something silly and trash Windows XP. If that is the case I should be able to restore it by:
~$ sudo time cat winxpsp2.img-part-* | bunzip2 | dd of=/dev/hda1

Tada! A brand new windows installation in mint condition.

A lot of steps:

  1. Install WinXP SP2 from CD
  2. Adjust folder settings. I like to see the folders NOT in simple view. I also like to see extensions.
  3. Move ‘My Documents’ to be on another partition
  4. Install motherboard drivers
  5. Turn off firewall, autoupdate and virus protection, then disable security center alerts.
  6. Join my local PC workgroup.
  7. Set up network 10.10.0.x/
  8. Configure the cmd shell. I like 100 chars wide, 55 deep, black background, light green text.
  9. Install a firewall. Currently using an old version of Tiny Personal Firewall (version 2). Might be time to try something else…
  10. Do lots of Windows Updates and enjoy your Windows Genuine Advantage check.
  11. Set as homepage in IE7
  12. Disable autoruns on all devices. (ie usb, CD’s, DVD’s etc)
  13. Install eraser to zero out all the unused HDD space.

It’s at this point that I figured the installation is worth backing up. (See next post…)

Before i re-install windows I thought it would be prudent to ensure that I select the correct partition to install on.

Finding out how your partitions are set up is quite easy in Ubuntu. Bring up a command shell and start the The GNU Parted disk partition resizing program, otherwise known as “parted”. To start it type sudo parted at the prompt.

Then all you have to do is type print all. Here is the output from print all on my PC:

Disk /dev/hda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 7863MB 7863MB primary fat32 boot
4 7863MB 15.7GB 7863MB primary ext3
2 15.7GB 79.5GB 63.8GB primary fat32 lba
3 79.5GB 80.0GB 526MB extended lba
5 79.5GB 80.0GB 526MB logical linux-swap
Disk /dev/hdc: 200GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 200GB 200GB primary ntfs

You can see I have two hard drives. Ubuntu references them as /dev/hda and /dev/hdc.

/dev/hdc is just a single partition of 200GB that I use to stash data on (My Documents, family pictures, mp3’s etc).

The other one – /dev/hda is a smaller drive I use to hold my operating systems. The logic here is that I can re-install Windows/Ubuntu as often as I like and my data will remain intact on the PC.

hda: [80GB] First hard drive

  • hda1: [7.8GB] Windows installation (C:\)
  • hda2: [63.8GB] General dumping ground – shared between operating systems. (G:\ in windows. Known as /media/hda2 in ubuntu).
  • hda3: [0.5GB] extended partition for holding logical partitions
  • hda4: [7.8GB] Ubuntu installation (\)
  • hda5: [0.5GB] linux swap partition

hdc: [200GB] Second hard drive

  • hdc1: [200GB] Data drive. (D:\ in windows. Known as /media/hdc1 in Ubuntu).