Installing grub4dos bootloader on a flash drive from linux console

Described by me below is extremely simple and obvious, but, I hope, this at least helps someone save a couple of hours of time.

On the Internet, you can find many articles on creating multi-boot flash drives. They all boil down mainly to using grub4dos and syslinux. What could be simpler: download, for example, grub4dos, unzip, start and press a couple of buttons? It works, only works under Windows.

What if I have linux? Here a situation arises when there are a little more questions on the forums on how to install the bootloader from MB from linux than there are answers. I admit, I myself was tormented until tonight.

Everything turned out to be simple

All you need is just:

  • Download and unzip the grub4dos archive ;
  • Create a primary partition on the USB flash drive and mark it as “bootable”;
  • “Pour” the bootloader using the dd utility into the boot record;
  • Copy the grldr file from the archive to the flash drive section.


In a nutshell about the master boot record (MBR). According to Wikipedia , her structure is as follows:
  • The bootloader code is 446 bytes;
  • Partition table;
  • Signature

Our task: copy the first 446 bytes from the grldr.mbr file to the beginning of the flash drive.


But not so simple. That was the whole problem. Copying 446 bytes is not enough. After that, we just see an error:
Missing MBR-helper

What is the matter?
The answer was prompted by the fact that the grldr.mbr file is 9 kilobytes in size. Everything was decided by copying the rest of it there - to the beginning of the disk (flash drive). Only the partition table and signature must be left; just skipping 512 bytes:

dd if=grldr.mbr of=/dev/sdb bs=446 count=1
dd if=grldr.mbr of=/dev/sdb seek=512 skip=512 bs=1

That's all. Now copy the necessary files, ISO-images to the USB flash drive, edit menu.lst. Fortunately, there is a tremendous amount of information on this part of the Internet.


This article prompted me to write that on some site I saw a method using dd, but it did not work due to the completely incomprehensible use of the parameters of this utility.

I hope someone will be helpful.

Also popular now: