Jump to content


create bootable hdd image with QEMU on Ubuntu

  • Please log in to reply
6 replies to this topic

#1 Einar



  • Members
  • 12 posts

Posted 27 October 2008 - 09:47 PM

Small howto on how to create a bootable harddrive with MSDOS. The image can be used for booting over pxe/netboot
(bear over wit me, I'm still very new to this netboot a harddrive-thingy)
Thanks to Jaclaz for pointing me towards the excelent QEMU
Full howto with images:

Until now I've got away with PXE-booting floppy disks containing various tools;symantec ghost clients, bios updates, password crackers etc.
With the recent ghost clients, however, both ghost AND different tcp/ip-drivers for various netcards do not any longer fit on a single floppy. So essentially we need to netboot a harddrive.

This howto is for Ubuntu. I have no knowledge of how to do this on windows (and i've come to the conclusion that I really do not care either). Beware though: There are probably about 187 different ways of accomplish the same as this howto, using WINPE, winbuilder, vista PE, dos netboot with network drive etc, This method might not be the best for you, or even suit your needs at all. Oh... and don't come yelling at me when you wrecked your MBR!

Install qemu:

# apt-get install qemu-launcher qemu
launch qemu (in “applications--->Accessories”)

Create a new emulated harddisk with as much space you need (the smaller the image, the faster your download with tftp will be).
Posted Image

With hard disk 0, create new image. Use “empty raw image”, give it a size of 100 MB (or any other size you prefer) and press “ok”.
Posted Image

“Insert” a floppy disk with MSDOS OS (or any other os of choice, for that matter)

I've chosen Msdos 6.22 (because it's available), but you could also use freedos, PC DOS 2000 (which comes with ghost). You need these dos programs: fdisk, format and sys.

Fdisk: dos disk partitioner
Format: format the drive
sys: make disk bootable (transfer SYStem)

Posted Image
At the DOS prompt, type “fdisk” to start the partitioner.

Posted Image
Choose “1”: Create DOS partition or Logical DOS Drive

Posted Image
Next, choose “1”, Create Primary DOS partition.

Posted Image
Answear “yes” to the question wether you would like to use all available space and make partition active.

Posted Image
Reboot the virtual machine.


after reboot, type “format c:” at the DOS prompt.
Proceed after the warning (answear “yes”)
Give a fairly reasonable name. Or not.
After the format is finished, transfer the system to your new disk. At the DOS prompt, type “sys c:”
Posted Image

You've just made a bootable harddrive image with MSDOS! With this tool, the world is truly yours! Now as it is, this disk is not very much usable, but fitted with the latest ghost version or perhaps bios updates for your clients or servers, it makes an awsome companion.


To boot your new image via pxe/netboot and pxelinux, you need this menuentry:

label blank disk harddisk testhd
kernel memdisk
append initrd=testhd harddisk

To mount your new harddrive image on a loopback interface:
sudo mkdir /mnt/dosdisk
sudo mount -o loop,offset=32256 /home/einar/qemu/hdd /mnt/dosdisk
sudo cp -r /home/einar/dosapps /mnt/dosdisk/
sudo umount /mnt/dosdisk

You may mount a floppydrive the same way, without the “offset”:
mount -o loop /home/einar/qemu/floppy.img /mnt/floppy

#2 ispy


    Silver Member

  • Tutorial Writer
  • 618 posts
  • Location:PILGRIM

Posted 29 October 2008 - 07:22 AM

Hi Einar :cheers: ,

Many thanks for sharing this information, keep this up & you could wind up being called a "Tutorial Writer"

On behalf of those who will find your tutorial useful Many thanks!
Regards & Respect,

ispy :cheers:

#3 Brito


    Platinum Member

  • .script developer
  • 10602 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
    European Union

Posted 29 October 2008 - 08:19 AM

Hi Einar.

Good tutorial, seems very easy to follow.

I see that in your blog you've posted some screenshots of these steps, would it also be possible to include them here in the tutorial?

Thanks and keep up the good work! :cheers:

#4 Einar



  • Members
  • 12 posts

Posted 29 October 2008 - 02:10 PM

I'll see if can get to it later in the evening...

#5 Einar



  • Members
  • 12 posts

Posted 29 October 2008 - 07:42 PM


#6 was_jaclaz



  • Advanced user
  • 7101 posts
  • Location:Gone in the mist

Posted 29 October 2008 - 08:13 PM

Just for the record. :cheers:

SYS is not needed.

Format /S will do.

and, just in case, the requisites for MS-DOS 6.22 are:
  • IO.SYS needs to be FIRST file in ROOT
  • MSDOS.SYS needs to be in ROOT
  • COMMAND.COM can also be in a directory (but it's better in ROOT)

MS-DOS 7.x and 8.0 have slightly different requirements (more "loose"):
  • IO.SYS needs to be in ROOT
  • MSDOS.SYS needs to be in ROOT
  • COMMAND.COM can also be in a directory (but it's better in ROOT)

So, you can make a DOS partition bootable by simply copying to it's root the files in this order immediately after FORMAT, even if you forgot the /S switch:
  • IO.SYS


#7 Einar



  • Members
  • 12 posts

Posted 29 October 2008 - 08:17 PM

Thanks for pointing out the fact that you do not need the sys command.
I actually found out, but after I made the tutorial

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users