===== Boot USB stick ===== Here a short instruction how to create a multiboot usb flash disk containing [[http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project|Syslinux]] ([[http://greenflash.su/Syslinux/Syslinux.htm|rus]]), [[http://diddy.boot-land.net/grub4dos/Grub4dos.htm|Grub4dos]] ([[http://greenflash.su/Grub4Dos/Grub4dos.htm|rus]]), [[http://www.debian.org|Debian x86/64]], [[http://www.fedoraproject.org|Fedora x86/64]], [[http://www.ubuntu.com|Ubuntu x86/64]], [[http://www.gentoo.org|Gentoo x86/64]], [[http://clonezilla.org|Clonezilla]], [[http://old-dos.ru/files/file_672.html|4DOS]], [[http://www.microsoft.com/windows/default.aspx?icid=winvan|MS Windows]] (experimental), [[http://www.sysresccd.org/Main_Page|SystemRescueCd]] ([[http://www.memtest.org/|Memtest86]], [[http://pogostick.net/~pnh/ntpasswd|NTpassword]], [[http://www.freedos.org|FreeDOS]], [[http://gag.sourceforge.net|GAG]], [[http://www.ranish.com/part|Ranish]], [[http://hdt-project.org|HDT]], [[http://www.dban.org|DBAN]], [[http://www.ihdd.ru/mhdd|MHDD]], [[http://netboot.sourceforge.net|Netboot]], [[http://www.gnu.org/software/grub|Grub2]], [[http://www.xfce.org|Xfce]], [[http://gparted.sourceforge.net|GParted]]). ===== Steps ===== ==== Make a backup ==== Firstly backup all data on the stick (using tar/cp/rsync). ==== Installing SystemRescueCD ==== * Under MS Windows: download image [[http://www.sysresccd.org/Sysresccd-manual-en_How_to_install_SystemRescueCd_on_an_USB-stick#B.29_Recommended_USB_installation_method_from_Windows|SystemRescueCD-Installer.exe]] and follow instructions given on the link. * Under GNU/Linux: Mount [[http://www.system-rescue-cd.org/Download/|SystemRescueCd-x86-x.x.x.iso]] with //exec// option and run as root //usb_inst.sh// script. Use this short script replacing //iso_path// to path to the iso file: iso_path=/path/to/systemrescuecd-x86-x.x.x.iso mkdir iso_dir && sudo mount -o loop,exec "$iso_path" iso_dir && sudo LANG=en TERM=screen iso_dir/usb_inst.sh \ && echo "SystemRescueCD successfully installed\! ;-)" || echo "Installation of SystemRescueCD failed\! ;-(" ; \ sudo umount iso_dir ; rmdir iso_dir Last SysRecueCD versions can be written with **dd** to the usb stick. ==== Set correct FS type ==== Set correct file system type to make >=DOS-7.1 understand it. Under GNU/Linux typesudo fdisk /dev/sdX # X - is the stick vfat partition, type 't', 'b', 'w', 'Enter'Additionally you can set a DOS fs labelsudo fatlabel /dev/sdX1 LABEL ==== Syslinux.cfg ==== Add menu items to //stick:/syslinux/syslinux.cfg// before first LABEL string match. LABEL Debian netinstall 32 bit MENU LABEL Debian netinstall 32 bit KERNEL vmlinuz-debian32 initrd initrd-debian32.gz LABEL Debian netinstall 64 bit MENU LABEL Debian netinstall 64 bit KERNEL vmlinuz-debian64 initrd initrd-debian64.gz LABEL Fedora netinstall MENU LABEL Fedora netinstall KERNEL vmlinuz-fedora LABEL Grub 4 Dos MENU LABEL 0) Grub 4 DOS KERNEL grub.exe # Firstly, Windows does not found files in /I386 folder because it searches in the root / of the stick. # Copying them to the root can make another troubles. #LABEL winxp # MENU LABEL Boot Windows 2000/XP/2003 (SETUPLDR.BIN) from CD/DVD # COM32 chain.c32 # APPEND ntldr=/I386/SETUPLDR.BIN #LABEL win7 # MENU LABEL Boot Windows Vista/2008/7 (bootmgr) from CD/DVD # COM32 chain.c32 # APPEND ntldr=/bootmgr # Solution: boot DOS >7.0 (6.0 does not see FAT32) and install under DOS. LABEL 4dos MENU LABEL 4DOS MS-DOS 7.1 RUS kernel memdisk append initrd=/bootdisk/4dos.ima floppy # Download if you need 6.22 version of DOS LABEL dos622 MENU LABEL DOS 6.22 kernel memdisk append initrd=/bootdisk/dos622.img floppy You can download and version of [[http://old-dos.ru/files/file_64.html|Dos 6.22]] and save as stick:/bootdisk/dos622.img ==== Grub4dos ==== Extract from [[http://sourceforge.net/projects/grub4dos | Grub4dos]] //grub.exe// file to the stick into /syslinux/ relative path. And create //stick:/menu.lst// config file for Grub4dos color black/cyan yellow/cyan timeout 30 default /default splashimage=/splash.xpm.gz foreground=AB82FF background=191970 # map + Contig/WinContig shows blue screen when detecting hardware # map --mem hangs in black screen for a long time, then reboot #title WinXP iso #find --set-root /winxp.iso # map /winxp.iso (hd32) # map --hook # root (hd32) # chainloader (hd32) # Way to install Windows XP, 2003, 2000, 98, 95 and restoring SYSLINUX boot loader after NTLDR rewrote it. # To install Windows XP select "Grub 4 Dos" menu item on boot screen, then select "Dos 7.1 Rus" item # and type: smartdrv ; c: ; cd c:\install\windows\i386 ; winnt.exe - Windows XP setup will start # For Windows 98 run setup.exe setup executable. # For that operations you need Windows installation CD with i386 directory. title 4DOS MS-DOS 7.1 RUS map --mem /bootdisk/4dos.ima (fd0) map --hook chainloader (fd0)+1 rootnoverify (fd0) ==== Debian netinstall ==== To get available Debian netinstall need to download [[http://ftp.debian.org/debian/dists/stable/main/installer-i386/current/images/netboot/debian-installer/i386/linux | kernel-32bit]], [[http://ftp.debian.org/debian/dists/stable/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz | initrd-32bit]], [[http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux | kernel-64bit]], [[http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz | initrd-64bit]] and move it to the //stick:/syslinux// directory renaming to //vmlinuz-debian32//, //initrd-debian32.gz//, //vmlinuz-debian64//, //inird-debian64.gz// accordinly. Under GNU/Linux you can do all operations by typing one command path=/mnt/flash ; release=stable ftp_url="http://ftp.debian.org/debian/dists/$release/main/installer"; \ ftp_path="current/images/netboot/debian-installer" \ && p="$ftp_url-i386/$ftp_path/i386" \ && wget "$p/linux" -O "$path/syslinux/vmlinuz-debian32" \ && wget "$p/initrd.gz" -O "$path/syslinux/initrd-debian32.gz" \ && p="$ftp_url-amd64/$ftp_path/amd64" \ && wget "$p/linux" -O "$path/syslinux/vmlinuz-debian64" \ && wget "$p/initrd.gz" -O "$path/syslinux/initrd-debian64.gz" \ && echo "Debian boot image files download successfully\! ;-)" \ || echo "Downloading Debian boot image files failed\! ;-(" ==== Fedora netinstall ==== To get available Fedora netinstall download [[http://dl.fedoraproject.org/pub/alt/bfo/bfo.lkrn | bfo.lkrn]] and save it as stick:/syslinux/vmlinuz-fedora. Example:path=/mnt/flash wget http://dl.fedoraproject.org/pub/alt/bfo/bfo.lkrn -O $path/syslinux/vmlinuz-fedora ==== Ubuntu installer ==== Download [[http://www.ubuntu.com/download|Ubuntu]] iso-file. Copy /casper directory to the root of flash to get structure like this. stick ├── casper │ ├── filesystem.manifest │ ├── filesystem.manifest-remove │ ├── filesystem.size │ ├── filesystem.squashfs │ ├── initrd.lz │ └── vmlinuz.efi Add menu items to Grub4dos menu.lst title Ubuntu LiveCD/Installer find --set-root /casper/initrd.lz kernel /casper/vmlinuz boot=casper live-media-path=/casper/ ignore_uuid initrd /casper/initrd.lz On new Ubuntu CD /casper directory may have another name so you must change it in the config. Also you probably want to change the title. ==== Gentoo stage3 ==== To get available Gentoo installers need to download [[http://mirrors.kernel.org/gentoo/snapshots/portage-latest.tar.bz2 | portage-latest.tar.bz2]], [[http://mirrors.kernel.org/gentoo/releases/x86/autobuilds/current-stage3 | stage3-i686-xxx.tar.bz2]] and [[http://mirrors.kernel.org/gentoo/releases/amd64/autobuilds/current-stage3 | stage3-amd64-xxx.tar.bz2]] to the //stick:/install/gentoo// directory. Under GNU/Linux all operations can be made in one step path=/mnt/flash full_path="$path/install/gentoo"; \ url_path="http://mirrors.kernel.org/gentoo/releases"; mkdir -p "$full_path" \ && fname=`wget $url_path/x86/autobuilds/latest-stage3-i486.txt -O - 2>/dev/null | tail -n1 | cut -d' ' -f1` \ && wget "$url_path/x86/autobuilds/$fname" -O "$full_path/${fname##*/}" \ && fname=`wget $url_path/amd64/autobuilds/latest-stage3-amd64-nomultilib.txt -O - 2>/dev/null | tail -n1 | cut -d' ' -f1` \ && wget "$url_path/amd64/autobuilds/$fname" -O "$full_path/${fname##*/}" \ && fname=`wget $url_path/amd64/autobuilds/latest-stage3-amd64-hardened+nomultilib.txt -O - 2>/dev/null | tail -n1 | cut -d' ' -f1` \ && wget "$url_path/amd64/autobuilds/$fname" -O "$full_path/${fname##*/}" \ && wget "$url_path/snapshots/current/portage-latest.tar.bz2" -O "$full_path/portage-latest.tar.bz2" \ && echo "Downloading portage and stag3 success \! ;-)" \ || echo "Downloading portage and stag3 failed \! ;-(" ==== DOS 7.1 ==== To have DOS 7.1 on the stick download diskette image from [[http://narod.ru/disk/27030580000/4DOS.IMA.html | narod.ru]] or [[http://www.backbone.ws/share/dist/dos/os | this site]] and move to the //stick:/bootdisk// directory. In Bash you cat type path=/mnt/flash wget http://www.backbone.ws/share/dist/dos/os/4dos.ima -O "$path/bootdisk/4dos.ima" \ && echo "DOS 7.1 download succes\! ;-)" || echo "DOS 7.1 download failed\! ;-(" ==== MS Windows ==== Setup MS Windows in this way with a 100% possibility it erases SYSLINUX boot loader because Windows Installer wrotes it's own boot loader from time to time. However if installation of Windows success you can got to Grub4dos using NTLDR and select DOS 7.1, then typec: ; syslinux.com c: //syslinux.com// must be extracted from //stick:/bootprog/syslinux-x.xx.zip/dos//. Also to install Windows XP you need to copy //ntdetect.com// from //i386// installation directory and //grldr// from [[http://sourceforge.net/projects/grub4dos | Grub4dos]] to the root of the stick. Menu config must be on the stick[boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect C:\grldr="Grub4Dos" ==== Clonezilla ==== Installing Clonezilla. Download latest [[http://sourceforge.net/projects/clonezilla/files/clonezilla_live_stable | stable]] or [[http://sourceforge.net/projects/clonezilla/files/clonezilla_live_testing | testing]] version of Clonezilla. Unpack three files from the iso by mounting it or by using File-Roller etc. You should get such directory tree.stick ├── live │ ├── filesystem.squashfs │ ├── initrd.img │ └── vmlinuz Copy from //clonezilla-live-xxx.iso/syslinux/syslinux.cfg// file strings from first "MENU TITLE" to last "MENU END" including them and insert before first "LABEL ..." string into //stick:/syslinux/syslinux.cfg// ==== More Grub4dos options ==== More Grub4dos menu list examples.title find and load NTLDR of Windows NT/2K/XP fallback 1 find --set-root /ntldr chainloader /ntldr savedefault --wait=2 title find and load CMLDR, the Recovery Console of Windows NT/2K/XP fallback 2 find --set-root /cmldr chainloader /cmldr #..................................... # write string "cmdcons" to memory 0000:7C03 in 2 steps: #..................................... # step 1. Write 4 chars "cmdc" at 0000:7C03 write 0x7C03 0x63646D63 # step 2. Write 3 chars "ons" and an ending null at 0000:7C07 write 0x7C07 0x00736E6F savedefault --wait=2 title find and load IO.SYS of Windows 9x/Me fallback 3 find --set-root /io.sys chainloader /io.sys savedefault --wait=2 title find and boot Mandriva with menu.lst already installed fallback 4 find --set-root /etc/mandriva-release savedefault --wait=2 configfile /boot/grub/menu.lst title find and boot Linux with menu.lst already installed fallback 5 find --set-root /sbin/init savedefault --wait=2 configfile /boot/grub/menu.lst title commandline savedefault --wait=2 commandline title floppy (fd0) chainloader (fd0)+1 rootnoverify (fd0) savedefault --wait=2 title back to dos savedefault --wait=2 quit title reboot savedefault --wait=2 reboot title halt savedefault --wait=2 halt title memdrive duplicated from floppy image file (hd0,0)/sbm.bin map --mem (hd0,0)/sbm.bin (fd0) map --hook chainloader (fd0)+1 rootnoverify (fd0) savedefault --wait=2 title memdrive based on win98 partition (hd0,6) map --mem (hd0,6)+1 (hd0) # map --mem (hd0,0)/win98.gz (hd0) map --hook chainloader (hd0)+1 rootnoverify (hd0) savedefault --wait=2 title Boot Windows XP root (hd0,1) chainloader +1 savedefault title Boot Options lock find --set-root /submenu.lst configfile /submenu.lst title Find “hdd.tag” and chainload partition find --set-root /hdd.tag chainloader +1 title Find and load “ntldr” find --set-root /ntldr chainloader /ntldr title debian-6.0.0-i386-netinst.iso (hd32 --mem) map --mem (hd0,0)/debian-6.0.0-i386-netinst.iso (hd32) map --hook root (hd32) chainloader (hd32) boot title debian-6.0.0-i386-netinst.iso (0xFF --mem) map --mem (hd0,0)/debian-6.0.0-i386-netinst.iso (0xFF) map --hook root (0xFF) chainloader (0xFF) boot title debian-6.0.0-i386-netinst.iso (hd32) map (hd0,0)/debian-6.0.0-i386-netinst.iso (hd32) map --hook root (hd32) chainloader (hd32) boot title debian-6.0.0-i386-netinst.iso (0xFF) map (hd0,0)/debian-6.0.0-i386-netinst.iso (0xFF) map --hook root (0xFF) chainloader (0xFF) boot title debian-6.0.0-i386-netinst.iso (--mem maxblast) map --mem (hd0,0)/debian-6.0.0-i386-netinst.iso (hd32) map --hook map --mem (hd32)/images/maxblast.igz (fd0) map --hook root (fd0) chainloader +1 boot title debian-6.0.0-i386-netinst.iso (--mem maxblast --mem floppy) map --mem (hd0,0)/debian-6.0.0-i386-netinst.iso (hd32) map --hook map --mem (hd32)/images/maxblast.igz (fd0) map --hook map --mem (fd0)/floppy.img.gz (fd1) map --hook root (fd1) chainloader +1 boot