About grub itself, bootable flash drives and especially special utilities for creating discs are no longer enough written, but they look narrowly oriented. For example, only to create a
Windows 7 flash drive, various
PEtoUSB , there are more versatile as in
this topic . A bunch of utilities essentially install the grub bootloader, isolinux (less often BCDW or lilo, even less often its own as Win7), and then put the files offered to it (Windows7, WindowsXP, Ubuntu, etc.) into folders. From here and exactingness to images (as they wrote in the comments to
this topic ).
Meanwhile, the absolute majority of the disks posted on the Internet (especially USB) just use isolinux and grub, which prevents them from simply being merged? never mind!
I will try
with examples to tell how to make a bootable, installation and just Live flash drive, and all in one without any tools sharpened for a specific distribution. And to be able, if necessary, to easily add something else to the flash drive, without another reformatting it.

(C) Picture
from thereDemonstration
For Linux users, there is no need to explain how to use the
grub-install / dev / sdb command, and the benefits of grub are obvious to them. Anticipating comments like
dd , I want to say that the article is aimed primarily at Windows users.
Windows users, I will try to explain the benefits of grub, and I hope I can convince you that grub needs to be kept, if not the first, then the second bootloader exactly (a flash drive with grub is exactly necessary).
For starters, you can try without mashing the MBR. It is enough to register grub in
boot.ini :
We will need the files from the
GRUB4DOS archive, copy them to the
C: \ root, not necessarily what it would be FAT, it works for me on NTFS:
default
grldr
grldr.mbr
menu.lstFor Windows XP, add
c:\grldr="GRUB4DOS" to
boot.ini . Everything.
Or run
GRUB \ install.bat from the file in the application (the
install.bat file is taken from the
xPUD © installer, and only adds grub, does not copy anything).
')
For users of Vista and 7, installation is somewhat more complicated than in XP - this is done through bcdedit:
make a backup
bcdedit.exe /export "C:\BCD.bak"bcdedit.exe /create /d "GRUB4DOS" /application bootsectorwe remember the
GUID of the form "{1a5b5afd-0469-110d-9a85-000103005000}", and then we replace this line in the
GUID command
bcdedit.exe /set GUID device boot
bcdedit.exe /set GUID device partition=%SYSTEMDRIVE%
bcdedit.exe /set GUID path \grldr.mbr
bcdedit.exe /displayorder GUID /addlast
Or just run
GRUB \ install.bat from a file in the application.
In general, the installation is completed on this, and you can already reboot and play with the command line (press
C after the grub menu appears).
For example, you can start booting from the drive:
chainloader (fd0)+1
rootnoverify (fd0)
bootFrom CD-ROM drive:
cdrom --init
map --hook
chainloader (cd0)
bootReboot:
rebootTurn off computer:
haltYou can boot from a pre-inserted flash drive (unless of course there is some kind of bootloader):
map (hd1) (hd0)
map (hd0) (hd1)
root (hd1,0)
chainloader +1
bootAnd you can start installing Windows 7, the image of which was simply unzipped to a USB flash drive (and the flash drive itself is not bootable):
root (hd1,0)
chainloader /bootmgr
bootLet me remind you that we did all this from the
command line mode. But 1 to 1 (by removing only the last
boot command), these commands can also be entered into
menu.lst , and they will work from the menu.
A case from the life: MBR of the first disk crashed, and for this, the BIOS immediately loaded grub from the second disk. Seeing the usual blue screen, I realized that the MBR, after the next experiments, is damaged and requires repair. All I needed was to switch to command line mode (
C ) and enter:
root (hd0,0)
chainloader /bootmgr
bootAnd the download of Windows7 started. After loading, I performed the
bootsect / nt60 c: / mbr And that's it (!)
No safe mode or recovery mode,
no what about 2-3 reboots , and certainly not any recovery discs (and I don’t have a CD drive on a netbook). After the procedure, it didn’t even have to reboot once again, Windows started up in normal mode (at one time I ran it for a week, forgot to restore the MBR after loading).
Also in the GRUB4DOS archive there are examples of automatic search for Windows XP and Windows 7 / Vista, and even if you do not know where you have Windows installed, you can still boot when the MBR has flown down.
Installation
And so, you are imbued and want to make yourself such a flash drive, but you already have a 16GB flash drive and format it extremely highly undesirable, and most common utilities (and instructions) for making boot flash drives offer to preformat it, which I think make sure that the FAT32 file system is exactly on the flash drive being created. And then install there again, grub or isolinux.
You can install grub without formatting (assuming, of course, that you already have FAT32, of which the absolute majority). There is a
Winrub utility (for GUI lovers), and in the
GRUB4DOS archive
there is
bootlace.com . Consider the
WinGrub option.
Previously, it was an sfx archive, which unpacks itself into% programfiles% and creates a shortcut on the desktop, which I did not like. It was enough to unpack it yourself by running grubinst_gui.exe later. When I wrote the article, I downloaded the latest version, there the installer is less complete . Swing, set. Or look at the attached file at the end of the article, I will post my kit for building the archive. We start, then we select the flash drive (based on the size), and in the partition list we select MBR or Whole disk. Click Install. The console window "
The MBR / BS has been successfully installed " appears, with the offer to press Enter, After which you click - it closes. If you wrote "
grubinst: Should be a disk image ", check the "Floppy image" checkbox and click Install again


Now GRUB4DOS is registered in the MBR.
After (although it is possible to DO), copy the files from the GRUB4DOS archive to the root of the flash drive:
default
grldr
grldr.mbr
menu.lstAnd we edit
menu.lst at will, in parallel we fill up the flash drive (some of the points can already be seen in the article above, and the archive itself contains examples).
Fill
1.
Alkid liveIn the full distribution there is an archive of multiboot.7z, where there is an example of a file for grub, from there we take it, and the ISO itself is simply unzipped to the root. Rename
i386 to
minint , if we forget, it will not start, but it will say that
minint was not found (which was so not an obvious hint).
Add to menu.lst
title Alkid Live CD
root (hd0,0)
chainloader (hd0,0)/minint/setuplns.binIn the
programs folder, you can remove the excess, if the flash drive is not very large. And also update the anti-virus database to the current state.
2.
Hiren's BootCDOpen the ISO and see that the folder
isolinux is in the
HBCD folder.
Unzip the HBCD folder to the root of the flash drive, open
isolinux.cfg :
menu label Start BootCD
kernel /HBCD/memdisk
append initrd=/HBCD/boot.gzwhich is easily converted to grub syntax
title Start BootCD
root (hd0,0)
kernel /HBCD/memdisk
initrd /HBCD/boot.gzadd it to
menu.lstInstallation is complete.
3. Some small utilities are already available on the Internet. usually this is a floppy image with memtest, ghost, dos, pqmagic. Booting from them is also not difficult. Register in
menu.lst :
title Ghost 11
map --mem /Ghost.ima (fd0)
map --floppies=1
map --hook
chainloader (fd0)+1
rootnoverify (fd0)I have EEEPC without a CD drive, and when the need to restore it suddenly arose, I didn’t even think where to get an external drive. Rewrote the Ghost image from DVD to a USB flash drive on a “big” computer, booted from a USB flash drive and restored.
4. Running the distribution. Take for example the image of
Parted Magic . Download image for USB. He is already on grub and has a very large menu of various boot options. To install it, unpack the archive, the
pmagic folder should appear in the root, and from
boot \ grub, copy the
menu.lst file to
\ pmagic , and add to our rough:
title Pagic
configfile /pmagic/menu.lstThis command will load the menu from native
menu.lst from pmagic, and we don’t have to invent anything at all. Unless to add in
\ pmagic \ menu.lst item to return back to our:
title <<main menu
configfile /menu.lstIn the latest version of PMagic, a bunch of utilities have been added, incl. memtest, grub recovery, hardware analyzer. I recommend independently to practice in the "relocation" of them on your flash drive, peeping in p.3 or
menu.lst .
5. Launch
Live Ubuntu . I had "
ubuntu-9.10-desktop-i386.iso ", using his example and consider. Also, unzip to the root. In the
isolinux folder (you can delete it later), in the
text.cfg file
we find how Live mode starts, and accordingly add our lines to
menu.lst (compare what it was and what happened)
title Try Ubuntu without any change to your computer
root (hd0,0)
kernel /casper/vmlinuz file=/preseed/ubuntu.seed boot=casper
initrd /casper/initrd.lz6. Installing
Debian (Ubuntu is installed in the same way):
To do this, we need the
HD-Media files (or a
graphical installer ) from the repository, and the ISO image
DVD1 . We add all this to the root, and in grub we add:
title Debian Install
kernel /vmlinuz
init /initrd.gzAfter the start of the installation, an ISO DVD1 image will be found and installation will continue without a network, without CD drives.
7. Installation on an Antivirus USB flash drive is much more complicated, for example, I painted the installation of Dr.Web Live CD
here .
Antivirus images did not manage to “properly” all on the USB flash drive, if someone can and will share the experience I will be glad (I haven’t been downloading them myself for a long time, perhaps in recent versions this is already much easier). In an image from Dr.Web, for example, there is even an installation guide for flash drives.
For reference, Live Antivirus images:
Dr.WebBitDefenderAvast! already paid: (
Symantec NAVPandaAvira8. DOS. It is worth sharing here, if we need DOS for some serious work, then it makes sense to find DOS-Live images, for example
this one , and load as in p.3. We run DOS to start the Windows XP installation from it later. From DOS we need:
AUTOEXEC.BAT
COMMAND.COM
CONFIG.SYS
EMM386.EXE
HIMEM.SYS
IO.SYS
SMARTDRV.EXEdesirable but not necessary:
Mouse.com
MOUSE.INI
OAKCDROM.SYSCopy all this to the root of the flash drive, and add to
menu.lsttitle DOS (Install WinXP?)
root (hd0,0)
makeactive
chainloader /io.sysHere you can either enjoy DOS, or prescribe in
AUTOEXEC.BAT (answer file of course if you wish):
smartdrv
cd \WinXP\i386
winnt /U:\WinXP\i386\winnt.sif9. Installing Windows 7. As already mentioned above, it is enough to unzip the ISO to the root of the flash drive, and add it to
menu.lst (already with
hd0.0 )
root (hd0,0)
chainloader /bootmgr
boot
10. Well, for an even account, I’ll talk about one more type of utilities. Some (not all!) ISO images can be downloaded directly from grub. Among these, I found: Acronis True Image, Acronis Disk Director, Active Password Changer. These are specially prepared images (not a simple copy of a CD), download them as follows:
title Active Password Changer
map (hd0,0)/Pwdchanger.iso (hd32)
map --hook
chainloader (hd32)Deletion
What to do if you accidentally installed the grub in the MBR of the main disk, and not flash drives, or do you need to remove it from the flash drive? You can use the utility
bootsect.exe as I wrote above.
If you have not yet rebooted (if you have rebooted, then use grub to boot Windows in the manner described above), and run
bootsect.exeTo restore Windows XP
bootsect / nt52 c: / mbrTo restore Windows Vista / 7
bootsect / nt60 c: / mbrThe bootsect is located in the
boot folder of the Windows disk, and is also in my archived archive at the end of the article.
A flash drive is simply formatted.
Conclusion
I hope that the examples will help someone to figure it out, and to someone interested in this bootloader, and utilities for creating bootable flash drives will cause a smile (I don’t want to offend anyone, I respect all developers, moreover, I started with such utilities). And of course, I highly recommend you to study grub in more detail, and GRUB4DOS, for example, here’s the
Russian manual on the latter.
Before adding the next distribution or utility, make sure that the folders do not match. Some Linux distros, with a certain skill and good command of grub, allow you to rename your folder without any serious consequences. Especially not big, like pmagic, puppy, xpud.
In general, do not be afraid to experiment, and good luck!
Also resources that can be useful to those who want to create their own bootable USB flash drive:
greenflash.suflashboot.rulexapass.narod.ruThe application is my archivator with everything you need: bootsect, DOS, grub install skipt, WINGRUB, grub4dos. As well as a
list of files on my flash drive with descriptions (some asked).
UPD:- Forum where discuss options for creating and downloading ISO images .
- In this article, from savvateev , he describes how to solve some problems that arise, including the fragmentation of ISO images.
- Article "Program for quick test boot disks . " With the help of the utility described in the article, a bootable USB flash drive can be tested instantly and without restarting the computer.
- The script to create LiveLinux from any distribution.