22 August 2013

How to install and run a full winxp on usb disk - Part 2

<< Back to Part 1

2. Make USB disk bootable with NTloader and Grub4Dos

2.1 Format the USB :

You need an USB disk larger than the disk image (4GB in this post). Format it with NTFS filesystem or FAT32 (make sure to backup it first !!!)


2.2 Make the USB disk bootable :

After format, suppose it has been mounted as D: drive. We will make it bootable by :
  • Make it as active partition (open Disk Management and right click / Set Active). 
  • Copy from C: drive these files (maybe you need to set Folder Options to show all hidden file) : ntldr, ntdetect.com, boot.ini
  • Search and download the Grub4Dos tool (or download here : https://drive.google.com/file/d/0B3OvTrPZEcO9M2hGZERaVHdJVUE/edit?usp=sharing ). Unzip it. Copy these files to the USB (D: drive) : grldr, grldr.mbr 

Now you need to place the ntloader bootcode onto the MBR of the USB disk. You will need the bootsect.exe tool (search for it in the WinVista or Win7 installation disc,  or download it here : https://drive.google.com/file/d/0B3OvTrPZEcO9NGVCeFpPNmRIUEE/edit?usp=sharing ), copy it to the C: drive. Then execute the command :

c:\bootsect.exe /nt52 d: /force

Now the USB disk can bootable, next we need to point NTLoader to load Grub4Dos. Edit the boot.ini file :

[boot loader]
timeout=10
default=c:\grldr
[operating systems]
c:\grldr="Grub4Dos"

Save the boot.ini file.

Let's restart the PC and boot from USB disk. The NTloader will load Grub4Dos according to the boot.ini file.


So, we now have the USB disk bootable according to :
  • Primary Active partition. 
  • NTloader in the MBR : ntldr, ntdetect.com, boot.ini 
  • Grub4Dos at second stage : grldr, grldr.mbr 

3. Boot the image by Grub4Dos.

3.1 Copy the vhd disk image to USB disk :

Restart the PC and copy the vhd image file (has been located at 1.6 step) to the USB disk. You should rename it from "winxp full.vhd" to "winxpfull.vhd" to kill the blank space.
3.2 Boot the disk image :

Reboot the PC and boot from USB disk, when Grub4Dos has been loaded, choose the command line menu. Enter these commands to load the WinXP image :

map (hd0,0)/winxpfull.vhd (hd0)
map --hook
chainloader (hd0,0)/ntldr
boot

and the WinXP image will be loaded as usual ... When done, you will see the disk image has been mounted as C: drive and the USB disk as D: drive. In Device Manager there also have a WinVblock disk appears under the Disk drive entry.

so we've almost done.

3.3 Create Grub4Dos menu entry :

Now we will create a menu entry for auto loading the image instead of manually typing the commands. On the USB disk (D: drive), create a text file named D:\menu.lst with the content :

timeout 5
default 0
title Boot to Winxp.vhd
map (hd0,0)/winxpfull.vhd (hd0)
map --hook
chainloader (hd0,0)/ntldr

Reboot the PC and boot from USB to see the result :

So, we have done for a full Winxp running in USB disk. You can try it on different PC to see the result.

Video show :




Known issue :

  • Not contiguous image file : You need to defragement the image file before load it.
  • Boot hang on new machine with SATA/AHCI controllers : Enter BIOS and switch the SATA/AHCI controller to use Compatible/Legacy mode. 

<< Back to Part 1


  

10 comments:

  1. Great guide!

    I followed this to the letter, and when I boot off the USB, I get an unknown file system error from GRUB and am sent to a recovery prompt. My USB was formatted NTFS to support the large .vhd file (7GB). I used Grub4DOS version 0.4.4 from the SourceForge project page, which is the same latest version available from the gna.org site. Any ideas?

    ReplyDelete
    Replies
    1. My suggestion :

      1. Make sure you can boot the usb with grub installed (without the vhd image).
      2. Have you tried with the smaller one vhd image ?

      Good luck with that.

      Delete
    2. I actually did try this, somewhat. I removed the menu.lst and tried to boot and got the same error. Am I using the correct version of Grub4DOS or is there one I'm not finding somewhere? Does the flash drive need to be formatted to FAT32? I haven't read anything anywhere about Grub4DOS that points to this..

      From the recovery prompt, I tried doing an ls and got:

      (hd0) (hd0,msdos1) (hd1) (hd2)

      Doing ls (hd0,msdos1)/

      Gives me the unknown file system error as well...

      It looks like maybe when booting off the flash, GRUB isn't recognizing the flash drive (itself) as a drive, perhaps? Or is hd0 the flash, and it just can't read the NTFS partition?

      Delete
    3. Try this :

      1. Unplug all the internal HDD, just leave only the usb disk.
      2. Use a different usb.
      3. Use a differnet PC (change BIOS mapping).

      Cheers.

      Delete
  2. I'm also having annoying issues, I've tried three different USB sticks and two different machines the same thing. Error 5 Partition table invalid or corrupt. I v'e tried NTFS, FAT32 partitions on all three USB disks. Nothing works. If I go to command prompt I can ls and see all the files, so why the hell doesn't it work ?

    ReplyDelete
    Replies
    1. Plz take a look at your pc BIOS usb mapping.

      Delete
  3. I've tried this setup on a laptop and I'm still having issues. When I booted up for the first time on this laptop I saw I made a typo in the menu.lst, so to be sure it did a ls and saw there was my winxp.vhd file. Ok so I then edited the menu.lst file and tried again and now grub says I have an invalid partition, what is going on?

    I've checked the BIOS on this laptop and the only option for USB is something called Legacy Support, which is switched ON.

    ReplyDelete
  4. I would use RMPrepUSB to format a flash drive.
    Use the WinPE+NTFS+Boot as HDD options.
    The install grub4dos using the 'Install grub4dos' button TWICE, once to the MBR and again to the PBR. This ensures it will boot on more systems.
    RMPrepUSB uses the latest grub4dos version which you need for vhd booting.

    ReplyDelete
  5. hi. thanks for the guide! i followed all the instructions and was able to create it. the only problem now is whenever i try to boot it, it will just stuck on the Windows loading screen. i even made sure that the vhd was defragmented and ran the chkdsk before i copied it over to the usb storage. i also did again all the process using another installation with a different iso file. any ideas for this? does this have to do something with the usb storage itself? thanks

    ReplyDelete
    Replies
    1. I guest the problem is hardware driver ! Edit the boot.ini : turn on /sos params to see what happen when booting (windows logo loading ...)

      Goodluck with that.

      Delete