Create a Bootable USB Drive with Ubuntu and FreeDOS

May 8, 2009 by Linerd · 9 Comments
Filed under: HowTo, Ubuntu, linux 

Sometimes you just need a DOS boot disk. Many motherboard manufacturers and computer companies only provide DOS based BIOS update utilities. A further challenge is that many computers no longer have floppy disk drives. The solution is to create a bootable USB drive that boots to FreeDOS. The beauty of this method is that you can create a DOS boot drive using only free software.

(Note: If you're looking for a way to make a bootable DOS flash drive in Windows, see: Create a Bootable FreeDOS USB Drive on Windows.)

I figured this out by reading the Gentoo Wiki and adjusted the instructions to work with Ubuntu 9.04.

First off insert the USB drive into one of your USB ports. The following steps will wipe out all of your files, so backup anything you want to keep.

Open GParted through System->Administration->Partition Editor.

Select the USB drive in the upper right corner. Make note of the device name. You'll need this later. In my case it's /dev/sdc.

Gparted USB Drive

Gparted USB Drive

Select the device in the lower portion of the window. Right click and select Unmount.

Select the device again and format it to FAT16 with Partition->Format to->fat 16. Click Apply to do the formatting.

Select the partition and go to Partition->Manage Flags and make sure that the device is marked as bootable.

Make Device Bootable

Make Device Bootable

Your screen should look something like this now.

USB Formatted to FAT16

USB Formatted to FAT16

Close Gparted.

Open Nautilus and select your flash drive to mount it.

USB Drive in Nautilus

USB Drive in Nautilus

Download the FreeDOS image from http://odin.fdos.org/odin2005/odin1440.img and save it to the flash drive.

Create a folder called grub on your usb disk and then copy all of the files from /usr/lib/grub/i386-pc to your new grub folder. The i386-pc part is architecture specific, so this may be different for your computer.

USB grub Folder

USB grub Folder

Also copy /usr/lib/syslinux/memdisk to the root of your USB drive.

Paste the following text into a text editor and save it as /media/disk/grub/menu.lst.

default=0
timeout=10
root=(hd0,0)
title FreeDOS
kernel /memdisk
initrd /odin1440.img

Now we need to install grub to the USB drive. Open a terminal and enter the following:

Note: make sure to substitute your device name from the Partition Editor for /dev/sdc.

cd /media/disk
sudo grub

grub> device (hd5) /dev/sdc
grub> root (hd5,0)
grub> setup (hd5)
grub> quit

As the Gentoo page mentioned, you may get a few non-fatal errors that you can ignore.

That's it. You can now copy your BIOS flash files to the USB drive and reboot your computer. Don't forget to set your computer's BIOS to boot to USB.

NOTE: As mentioned in the comments, it's easier to create a bootable FreeDOS USB drive with UNetbootin.

Windows 7 Hosed my Boot Record

January 31, 2009 by Linerd · Leave a Comment
Filed under: HowTo, Ubuntu, linux, windows 

Last weekend I finally decided to give the Windows 7 beta a try. I've got three hard drives in my computer. Drive 1 has Windows 2000 and Ubuntu 8.04 on it. The Grub boot loader is on the master boot record to select the OS at boot time. Drive 2 is set up as a storage drive. Drive 3 is set up with a large storage partition along with a 20 GB boot partition that had Fedora 10 on it. I purposely had this set up separately for testing. It requires changing the boot order in the BIOS in order to use it. This seemed like the perfect place to install Windows 7 to try it out.

As you can tell from the title of this post, things did not go as planned. I booted to the Windows 7 DVD to begin the install. When I got to the point where you choose the installation partition, Windows said it couldn't install on my 20 GB ext3 partition. It would only allow selection of ntfs partitions. If there was an option to reformat at that point, it wasn't obvious to me. So I rebooted back into Ubuntu to reformat the partition with GParted.

After that was done, I booted to the Windows 7 DVD again and proceeded with the installation. I selected the 20 GB partition on drive 3 and Windows went ahead with it's installation. After the requisite reboots, Windows didn't work. Why didn't it work? It didn't work because I had drive 3 set as the boot drive. I'd had the naive belief that if I told Windows to install on partition 1 of drive 3 that it would leave my other drives alone and set up the master boot record on drive 3. No such luck. The folks at Microsoft decided to do me a "favor". Windows 7 detected that Windows 2000 was installed on drive 1, so did me the "favor" of setting up a boot loader for me in the master boot record of drive 1. After resetting the boot order in my BIOS to boot to drive 1 I was able to boot into Windows 7. Interestingly the boot selector showed Windows 7 and "Other Windows". What happened to Ubuntu?

I figured I'd try searching the internet from the new Windows 7 installation. No luck there either. A lot of people try to say that Linux will never be popular because it's too hard to get everything working on a new installation. It is the goal of many Linux distributions to "just work" after installation. I can tell you most certainly that the latest version of the most popular operating system in the world does not "just work". My USB mouse didn't work. I had to connect it with a PS2 converter. I couldn't get on the internet either. No real surprise really. I had not installed the drivers from the CD that came with my motherboard. The point is that most of my hardware works right away in Ubuntu without extra configuration or special driver installation.

OK, back to the issue of restoring the master boot record (MBR) on my primary hard drive. A quick search of the internet yielded a solution on the Ubuntu Forums. I'm adding a few preliminary steps here to make the procedure more clear. The first is step is to boot an Ubuntu Live CD. Then open up the Nautilus file manager, find you Ubuntu drive partition, and navigate to /boot/grub. Open up the file called menu.lst and find the section that looks like

## default grub root device## e.g. groot=(hd0,0)# groot=(hd0,2)

The (hd0,2) part from the bottom line is what's important. This is the hard drive number and partition for your Grub installation. For the rest we'll need to open up a terminal window. You'll need to sudo to root with

sudo su

Then enter the command

grub

Next, enter

root (hd0,2)

Make sure to use the hard drive number and partition you found in your menu.lst file. Next, enter

setup (hd0)

again, substituting your proper hard drive number. Finally, exit the grub configuration with

quit

and reboot. You should see the familiar Grub boot loader when your machine starts.

If you want to install Windows 7 on a configuration like mine, I suggest you either disable your main hard drive in your BIOS (if possible), or better yet, disconnect it from the motherboard.