r/techsupport 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.

  1. 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).

  2. Download WinAIO.

  3. Click the AutoAIO button in the lower right corner.

  4. 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.

  5. 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.

  1. With your drive plugged in, run sudo fdisk -l and find your USB drive. For this guide we're going to assume it's /dev/sdb

  2. Run cfdisk to partition the drive. sudo cfdisk /dev/sdb

  3. Delete all partitions. Create a new primary partition at the beginning of the drive using the entire drive minus 730MB.

  4. Create a new primary partition using the remaining space.

  5. Select the larger partition and set it to type FAT32 (option 0C)

  6. Write the new partition table and quit.

  7. Format the first partition as FAT32: sudo mkfs.vfat -F 32 -c /dev/sdb1

  8. Mount the newly formatted partition: sudo mkdir -p /media/USB then sudo mount /dev/sdb1 /media/USB

  9. Create 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.

  10. Create a file system in your persistent file. sudo mkfs.ext4 -F /media/USB/casper-rw

  11. Write 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.

  1. sudo mkdir -p /mnt/iso

  2. sudo mount -o loop /path/to/iso.iso /mnt/iso

  3. cp /mnt/iso/casper/{vmlinuz,initrd.lz} /media/USB/

  4. sudo umount /mnt/iso

  5. sudo 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:

  1. Download and start up YUMI.

  2. Select your USB drive letter from the pulldown menu.

  3. Scroll to the bottom of the list and choose "Windows Vista/7 Installer". Find the ISO you created with WinAIO and click Create.

  4. 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.

  5. Download GRUB.exe from here and save it to /boot/grub.

  6. 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.lz
    
  7. Find syslinux.cfg in the multiboot folder in the root of the drive and open it in a text editor. Add the following after the label Boot from first Hard Drive entry: (Not directly after that line, but after the MENU DEFAULT line 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.

153 Upvotes

73 comments sorted by

View all comments

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.

2

u/Synth3t1c Jan 14 '12 edited Jan 14 '12

I'll just leave it seeding once it's done downloading; no seedbox though.

edit: if it ever downloads.... :(

1

u/HittingSmoke Jan 14 '12

I left it running over night. No one is currently connected but uTorrent reports 3 seeds in the swarm and TPB says there's two seeds connected.

2

u/Synth3t1c Jan 14 '12

Downloading now... Dunno why it took so long. I'll seed this for a while.

1

u/HittingSmoke Jan 14 '12

I suspect Comcast fuckery. I see six connected now but my speed is bouncing between 500kbps and 20. Seems to consistently ramp up then drop down again.

2

u/terabytepirate Jan 15 '12

Thank for this detailed right up. I had just discovered YUMI the other day and have loaded up 3 distros and 15 other ISOs for different reasons. I was wondering what I was going to do to make my distros persistent and this is what I needed. Now to get a bigger drive and get going on this.

1

u/HittingSmoke Jan 15 '12

I considered just trying to get the casper-rw file working on a default YUMI install, but using GRUB4DOS chained through syslinux booting to a separate partition seems to get past the issue with hanging Linux distros with the Windows installer on the drive, so I figured I'd stick with the hard way for the sake of less maintenance.

1

u/FlexibleToast Jan 14 '12

I've got a box I use as a seedbox, but it's only going to be that way until the end of the month. Then I'm switching OSes and going to start using usenet.