[SoaS] Direct SoaS

Bernie Innocenti bernie at codewiz.org
Mon Jan 18 22:11:47 EST 2010


[cc += soas@]

Context: I've ripped SoaS apart to generate a USB stick which boots
directly off ext3 using Grub. It feels a lot faster, it's cleaner, and
certainly doesn't die miserably after writing too much to the LVM overlay.

The main downside is that the USB stick is no longer usable with Windows
until reformatted. A small loss, if you ask me :-)

There's also no swap, but it could be done on a swap file. Anyway,
swapping in general is not very elegant and swapping to flash seems like
a really dumb idea.


On 01/18/10 22:15, Caroline Meeks wrote:
> you could try running it overnight. Or could you talk Anurag or Daniel
> through creating one?

It's a simple manual procedure, but I'm going by memory and skipping
over the details. If you need more info, I'm always on IRC.

 * First, loopback mount the ISO (mount -o loop soas.iso /mnt)

 * Inside the ISO filesystem, you'll find a directory LiveOS containing
   a big squashfs image. Mount it with a similar command line, maybe to
   a new directory /mnt2

 * Inside this squashfs image, you'll find a third filesystem image,
   this time ext3. Mount this one too.

 * Now take a USB stick and use a partition tool such as parted
   or fdisk to change the partition type to 0x83 (Linux) and make
   it bootable ("a" on fdisk).

 * Ensure the USB stick has 255 heads, 63 sectors/track, which is
   the only supported layout for booting off USB-HD in some BIOSes.
   parted does this automatically when creating the partition table
   anew (mklabel).

 * Format the first partition as ext3 or, better, ext4.

 * use something like "rsync -aP /mnt3/ /mnt4/" to transfer everything
   to SoaS filesystem to the newly formatted USB filesystem

 * Now comes the tricky part: chroot into the partition on the USB
   stick. To get a working system, you'll have to add a few bind mounts:

      mount --bind /proc /mnt4/proc
      mount --bind /dev  /mnt4/dev
      mount --bind /sys  /mnt4/sys
      chroot /mnt4

   Voila', you're in!

 * This should convince grub to install into the MBR of our USB stick:

      echo '(hd0)  /dev/sdX' >/boot/grub/device.map

   where sdX is the device of the entire USB stick.

 * grub-install '(hd0)'

 * exit the chroot and unmount everything in reverse order

Now cross your fingers and reboot. If you've accidentally wiped your
hard drive MBR or boot partition, reinstall the system and then send me
a cheerful comment of your choice.

If, instead, it's your lucky day and it boots, it would be a great idea
to turn the above instructions into a shell script.

Even better yet, someone could modify the soas build scripts to directly
produce a bootlable hard disk image for 4GB sticks. 2GB sticks will also
work, but they're less common.

An interesting research project would be finding a way to automatically
resizing the partition table and the filesystem within to fill up the
entire media. This could be done on first boot.

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs       - http://sugarlabs.org/


More information about the SoaS mailing list