Joined: 13 Jul 2008
Location: New Zealand
Creating bootable pendrives with HxD
Here is the text of a document I created a couple of weeks ago. I've also attached it in rtf (WordPad) format. I made a pdf version too but it bloated 7kb into 78kb
Edit: the attachment didn't work because rtf files are not allowed
Creating Bootable Pendrives with HxD
HxD makes it a very quick and easy process.
You simply Open the USB pendrive, Open the boot image file, Paste-Write the image to the pendrive's start sector, then Save the changes to the pendrive.
Before the Paste-Write you can also use HxD to create a back-up image file of the sectors you are about to overwrite. HxD can then restore the original pendrive if required.
Detailed step-by-step instructions are listed below for HxD version 220.127.116.11. with default settings.
1. This procedure has so far only been tested on pendrives 16GB or less (mostly 4 and 8GB devices) with conventional MBR's and Partition Tables, all of which have contained a single FAT32 partition. It should also work on larger pendrives which might have NTFS partitions, but HxD's support for possible future GPT-enabled pendrives is unknown.
2. Not all pendrives have the Boot Flag (at offset 1BEh in the MBR, the first byte of the Partition Table) already set, although many do. So before you can boot from your pendrive you may also need to use HxD to change byte 1BEh in Sector 0 from 00 to 80h. Alternatively you may wish to replace the MBR with a more user-friendly one, like NUMBR (Neville's User-friendly MBR; see the author's contact details below).
3. Pendrives have widely-varying Partition Start sectors (e.g. 20h, 3Fh, C38h, 14B8h etc). The Start Sector is the dword defined at offset 1C6h in the pendrive's MBR i.e. bytes 8-11 of the Partition Table. If you are writing a standard boot image to the existing partition, the dword at offset 1C6h is the absolute sector number to which you should Paste-Write the image using HxD. Remember that in HxD, sectors are always specified in decimal, not hex.
4. To boot from your pendrive you need to ensure USB Booting is enabled on your PC. This may be a BIOS setting such as Boot Sequence, where you must ensure USB or removeable devices will attempt to boot before fixed (hard) disks. You may also need to separately enable Legacy USB or USB booting specifically.
5. It is assumed that your USB booting uses hard disk emulation, so that your PC treats the USB device as a hard disk. However a few PC BIOS's also support floppy disk emulation when booting USB pendrives. Sometimes the USB device is then referred to as a "USB key" rather than a USB drive or pendrive. If you want to use floppy disk emulation then you must Paste-Write your boot image starting from Sector 0, which of course immediately overwrites the MBR and Partition Table.
6. All tests have been done using Windows XP SP3 only. Later versions of Windows may require Administrator or other "privileges" to provide write access to your USB boot sector and MBR.
7. HxD can be downloaded using FTP or HTTP from:
There is also the choice of several different language editions, and installable or portable stand-alone versions. HxD is free for private and commercial use. The portable version 18.104.22.168 is a 789kb ZIP file which includes the licence, readme, changelog & executable files. HxD was written by Mael Horz in Object Pascal.
Detailed step-by-step instructions to write a bootable image to your pendrive:
1. Run HxD (as Administrator if needed for Write Access)
2. Click on the Open Disk icon (under and slightly to the left of "View")
or select Extras->Open Disk...
3. In the Open disk dialog, uncheck "Open as Readonly"
4. Under Physical disks, click on your USB drive (removable Disk)
5. Click OK
(Data display shows the contents of the pendrive's first sector, Sector 0)
6. Enter 80 at offset 1BEH if not already set. (80 is coloured red, indicating a change)
7. Note the starting sector dword at offset 1C6H, and convert it to decimal.
8. Type the decimal starting sector number in the Sector field on the right below the menu bar, and press Enter. (Data display shifts to the specified sector)
9. Click File->Open
10. Select the bootable image file to write to the pendrive
At this point, if you want to backup your pendrive, see the additional instructions below.
11. Select all (Ctrl-A, or right click/Select all, or Edit>Select all )
12. Copy (Ctrl-C, or right click/Copy, or Edit>Copy
13. Reselect the Removable Disk tab for your pendrive
14. Double check that the sector number is still correct (paranoia!)
15. Paste Write (Ctrl-B, or right click/Paste write, or click Edit->Paste write)
(Data display shows over-written data in red)
16. Save (Ctrl-S, or click File->Save)
Click Yes in response to any Warning message that changes cannot be undone.
17. Wait a few seconds or until the pendrive's LED stops flashing before closing HxD and removing the pendrive.
Note: The changes are only buffered and the pendrive is not actually updated until the Save in step 16.
Additional instructions to create a backup image of your pendrive.
10a. Determine the size in bytes of the bootable image file and divide it by 512 and round up for the minimum number of sectors you must copy to your backup image.
10b. Reselect the Removable Disk tab for your pendrive
10c. Select at least the minimum number of sectors (e.g. using Shift-Cursor down/PgDn) starting from the partition start sector
10d. Copy (Ctrl-C, or right click/Copy, or Edit->Copy
10e. Click File->New
10f. Paste Write (Ctrl-B, or right click/Paste write, or click Edit->Paste write)
(Data display shows over-written data in red)
10g. Click Ok in response to the Warning message about changing the file size
10h. Click File->Save As and enter a new name for your backup file
10i. Reselect the bootable image file tab and return to step 11 above.
If you ever want to restore your pendrive, follow the detailed instructions 1-17 above, but use your backup image instead of the boot image.
_________________ FAMOS - the first memory operating system
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum