Thursday 10 December 2009

Creating blank partitioned drives (2)

In my previous post, I described a method of creating test filesystems for VeRa such that:
  • The drive contained multiple partitions;
  • Each partition could be a different filesystem; and,
  • The drives existed in a raw image format (such as would be extracted by dd or equivalent software).
Last week, VeriSign very kindly sent me a 2Gb USB drive; although as a drive it is significantly smaller than those that VeRa are targetted at, 2Gb is still sufficient for multiple partitions, filesystems and files within these. Unfortunately, Windows XP and Vista see USB drives as removable rather than fixed storage and therefore do not allow more than a single partition.

Two solutions exist to this; one involves a minor alteration to the data on the USB drive, whilst the other alters the way in which Windows treats the drive itself. Note that these require using third party software and may produce unreliable results that, at worst, may lead to serious data loss.

Removable Bit

An article on describes the tool 'Lexar Bootit', which allows the 'removable' bit on the USB drive's descriptor to be set as false; in theory, this then makes the USB drive appear as fixed storage to any PC it is plugged into. In practise, it only appears to work with a selection of drives, and specifically not my otherwise-unbranded VeriSign one.

Replacement Driver

When a USB drive is first used in Windows, a standard driver is used that reports back to the operating system whether the drive is removable or not. Some years ago, IBM released their Microdrive, a tiny hard disk with the form factor of a removable CF media card. Because sizes for these went above the 4GB limit of the FAT filesystem that portable devices often used, the Windows driver for these Microdrives (now sold under the Hitachi branding) allowed them to be presented to the operating system as fixed drives suitable for containing multiple partitions.

This page, as well as mentioning the Lexar application above, also shows a method in which this Hitachi driver can be altered to allow it to be applied to any USB memory device; as a result, Windows can be persuaded to treat any USB memory device as a fixed (partitionable) drive.

Through this second method, I have been able to create test images with multiple filesystems without the additional requirement of a virtual machine. Note that other PCs will not be able to view anything other than the first partition; this could be used to hide data, but if that is not the intention I would recommend keeping a copy of the altered driver on the first visible partition.