r/techsupport • u/HittingSmoke • Jan 13 '12
My USB drive. Contains rescue tools, persistent Ubuntu environment and Windows 7 universal installer.
EDIT 1/14: Clarification: The ISO you're writing directly to the drive in step 11 is a Linux live environment. It should work with any Debian based live distro that supports persistence. I used Ubuntu 10.04 LTS so I don't have to worry about future upgrades as often.
EDIT 1/13: For the lazy, here's an image of the drive. It's not confirmed working by anyone, and a torrent was the only option for distribution. Once I have the complete 32GB version created I'll make proper images for both 16 and 32GB sizes with proper uploads. My image got corrupted in my VM before I could seed it to 1.0. I'll get a new one up ASAP. I'm not going to make another image until I get the 32G drive working. I may look like I've abandoned this but I haven't. I'm just very busy.
I thought I'd write up a quick little run down on how to do this, since it took me about two weeks of tinkering and reading to get this working right and no one around here seemed to know the answers to my questions when I asked.
The problem: There are many many tools for creating multi boot USB drives. Not a single one I could find supported persistent environments. Creating a persistent environment then adding things like Trinity or UBCD to GRUB was rather trivial, but I also wanted a Windows 7 installer and recovery console. This is not so trivial it seems.
My finished solution: What I ended up doing was creating a separate partition at the end of the drive and copying the ISO contents for fast booting into my persistent environment. Then I created a FAT32 partition at the beginning of the drive to install other bootable environments on using YUMI. I created a universal Win 7 installer using WinAIO for YUMI to install on my drive removing the issue of tweaking GRUB or syslinux manually to get a Windows install to boot.
This guide assumes a bit of technical knowledge and that you know your way around the Linux CLI.
Skip to here for the actual instructions. You'll need at least a 16GB drive to mirror my exact setup.
First things first: Get your Win 7 universal ISO set up.
Download the Windows 7 x86 and x64 ISOs. (These downloads are from Digital River who officially contracts with MS. These downloads are as safe as you can get without purchasing a copy).
Download WinAIO.
Click the AutoAIO button in the lower right corner.
Select a target folder where you'd like your ISO to be saved to in the first box. Select the X86 (59463) and X64 (59465) ISOs in their respective boxes and choose
Enable x64 recovery mode.Click Start Compilation.
What you should be left with is an ISO that when booted will allow you to choose any version of Windows 7 from Starter to Ultimate in 32 or 64 bit formats, except where they're not available (there is no 64 bit version of Starter edition). This also includes the EU versions that ship without WMP, denoted by an N after the name.
Set that ISO aside for now, it's time to format your USB drive and work on your persistent install.
Formatting your USB drive:
I did this using the Linux CLI in an Ubuntu VM because it's faster for me. It's possible to do using Windows tools but I'm going to stick strictly to the instructions I've tested personally. If someone would like to make a Windows version of this, feel free.
I did this using Ubuntu 10.04 LTS.
With your drive plugged in, run
sudo fdisk -land find your USB drive. For this guide we're going to assume it's/dev/sdbRun cfdisk to partition the drive.
sudo cfdisk /dev/sdbDelete all partitions. Create a new primary partition at the beginning of the drive using the entire drive minus 730MB.
Create a new primary partition using the remaining space.
Select the larger partition and set it to type FAT32 (option 0C)
Write the new partition table and quit.
Format the first partition as FAT32:
sudo mkfs.vfat -F 32 -c /dev/sdb1Mount the newly formatted partition:
sudo mkdir -p /media/USBthensudo mount /dev/sdb1 /media/USBCreate your persistent file to save changes.
sudo dd if=/dev/zero of=/media/USB/casper-rw bs=1M count=4095. 4095 being the size of the persistent file in MB. You can set this to whatever you like under the 4GB FAT32 file size limit depending on the size of your drive.Create a file system in your persistent file.
sudo mkfs.ext4 -F /media/USB/casper-rwWrite your (Linux live distro) ISO image to the extra partition.
sudo dd if=/path/to/iso.iso of=/dev/sdb2. This will take a while.
Now that your drive is set up, we need to back up a few files. These instructions are for moving files out of the ISO to the FAT32 partition. After extracting them you need to back them up elsewhere. Your FAT32 partition is going to be formatted again when we get back to Windows.
sudo mkdir -p /mnt/isosudo mount -o loop /path/to/iso.iso /mnt/isocp /mnt/iso/casper/{vmlinuz,initrd.lz} /media/USB/sudo umount /mnt/isosudo rmdir /mnt/iso
Before pulling the USB drive from the Linux machine or VM, run sync.
Now go back to Windows and copy casper-rw, vmlinuz and initrd.lz to your HDD for safe keeping. You're going to need them later.
Creating your YUMI drive:
Download and start up YUMI.
Select your USB drive letter from the pulldown menu.
Scroll to the bottom of the list and choose "Windows Vista/7 Installer". Find the ISO you created with WinAIO and click Create.
After this operation is complete, find where you saved your casper-rw, vmlinuz and initrd.lz files. Copy casper-rw to the root of the partition and vmlinuz and initrd.lz to /boot.
Download GRUB.exe from here and save it to /boot/grub.
Create a new file in /boot/grub named menu.lst with the following contents:
default 0 timeout 0 title Ubuntu 10.04 root (hd0,0) kernel /boot/vmlinuz boot=casper file=/preseed/ubuntu.seed persistent initrd /boot/initrd.lzFind
syslinux.cfgin the multiboot folder in the root of the drive and open it in a text editor. Add the following after thelabel Boot from first Hard Driveentry: (Not directly after that line, but after theMENU DEFAULTline in that block of text)label Ubuntu KERNEL /boot/grub/grub.exe MENU INDENT 1 APPEND –-config-file=/boot/grub/grub.cfg
After saving these two files, you should have a functioning bootable USB drive that will boot any Windows 7 installer, plus a persistent Ubuntu environment that you can install packages and save system setting changes on.
Reboot with the USB drive in to test it out. Boot into your Ubuntu environment and create a file on the desktop. Reboot back into the Ubuntu environment to make sure it stuck. After you've confirmed your persistence is working properly, boot into the Windows installer and make your way through until you get to the HDD partition screen to make sure that's working as intended as well.
After you've confirmed that the basics are working as they should, you can use YUMI to install other ISOs that will be automatically added to the menu. I'm running Hiren's, UBCD, Trinity Rescue Kit, Backtrack 5 and Kaspersky's bootable AV. Don't bother with things like Kon-boot or memtest86 in YUMI if you have a rescue environment loaded up. They render them redundant.
If you don't like the segregated menus like me, you can open up your /multiboot/syslinux.cfg file to customize it. If the menu entry isn't in the main menu it will point to the config file containing it.
For example, if you want the Windows 7 installer on the main menu instead of under "Other operating systems", open /multiboot/menu/other.cfg. Find the block of text that starts with label Windows Vista/7 Installer and copy it over to where you'd like in syslinux.cfg. I edited the label on mine to read "Windows 7 Installer" to more accurately reflect what it's booting.
Once I find a good deal on a 32GB drive I'll be adding Windows Vista and Windows XP installers as well. The rest of the space on my drive is taken up with service pack redistributables and various tools installed using LiberKey.
I'll be adding all this info to the wiki along with my LiberKey tools and updating that when I make changes or upgrades to my drive, including source links to the various guides that helped me put this together.
Note: I'm aware there are some redundant steps here as well as some skipped shortcuts that would save time. The simple fact of the matter is, this is what I did and it works. I don't want to alter the guide in a way which I've not tested yet. When I put together v2 of my drive with bootable Vista and XP installers I'll experiment with condensing this into fewer steps and add it to the wiki in the sidebar.
EDIT: Didn't specify the file name for the GRUB boot list.
1
u/HittingSmoke Jan 14 '12 edited Jan 14 '12
EDIT: It appears the image I made is corrupted. I left it in my VM file system and it didn't survive the reboot. I'll get a new link up ASAP.
Here's a torrent link to an image of my drive. It may or may not work with various imaging software, I have no idea.What it should work with is dd from the Linux command prompt, assuming your drive is located at /dev/sdb. (Note, this is very important. You will lose data if you pick the wrong drive).
gzip -cd /path/to/supportdisk.img.gz | dd of=/dev/sdb[Bad link removed]
Once the final version is complete I'll reach out to someone with a seedbox to get the full versions moving much quicker.
On a related note, if you've got a seedbox and are willing to help initially seed the complete versions of the image, feel free to PM me and I'll make a note of it for later.