Boot from USB

The following instructions explain how to make a usb storage device (like usb stick) bootable with grub and install dyne:bolic on it so that you can run it from USB, without harddisk or CD.

If you are looking for instructions on how to save your personal data on a USB stick, then this is not the right place: look at Nesting. If you're looking to copy the entire system over to your harddrive, again, this is not the right place, look at Docking. This section documents on how to put the whole system on the usb stick.

The whole system requires a USB device about the size of the /dyne directory (currently ~655MB at version 2.4.2) + ~30MB (for file system headers). Therefore, the entire system should fit on a USB stick of ~685MB, but you may want a bit more space for your personal files. If your USB stick is smaller try Nesting instead.

How DyneII loads (technical):

the boot system consists of a bootloader, in our case grub
the bootloader loads a kernel, in our case linux :)
the kernel loads a ramdisk, in our case dyne:II initrd.gz
the ramdisk will look for a dyne/ dock
we keep both kernel and ramdisk in a dock and install grub

First of all find what device your USB drive is
[d:b] ~ # cat /proc/partitions [Enter]
Ignore the entries that end in numbers, those are individual partitions on each separate device. The ones that end in letters are different devices: hda means your primary IDE harddrive, sda (or sdb sdc etc.) generally means a USB device (but can also mean a SCSI or SATA harddisk, be sure to verify this on your specific system configuration)

If you're confused, look at the blocks column, which shows the # of 1KB blocks on the device. If you know how big your USB stick is, you can find it this way. ~1,000,000 blocks = a 1 gigabyte device; ~64,000 blocks = 64MB device. From here on this tutorial assumes your usb device is /dev/sda, if it's not /dev/sda, change it as necessary.

Now let's prepare the partitions of the usb key: in this example we are using the console based cfdisk here, but you can also try to use Parted which is a graphical tool in MENU->FILES->Parted. Be careful that you selected the right device to operate on (eventually different from the /dev/sda in the examples below) because from now on the operations described will erase all data on the device.

Let's start the partition tool:

[d:b] ~ # cfdisk /dev/sda [Enter]
Now from inside cfdisk:

delete all partitions
create a new primary at the default maximum size
set the type to 83 (Linux)
Write everything and then Quit

Now you are ready to format your drive:
[d:b] ~ # mke2fs /dev/sda1 [Enter]
You can change the above command mke2fs -j in case you want to use EXT3 instead of EXT2. However, it is probably not advised to use the EXT3 journaled filesystem on a flash/USB device: journaling writes to the disk more often than necessary, which wears out the USB device more quickly. Use a non-journaled filesystem such as EXT2 (Linux only) or FAT32 (if you want to make your usb device readable outside of Linux). The default (ext2) is a safe choice, however, you may want to read up on journaled vs non-journaled file systems and make an informed decision in your case.

Now mount the drive:

[d:b] ~ # mount /dev/sda1 /mnt/usb  [Enter]
And Install the bootloader (grub):
[d:b] ~ # grubconfig [Enter]
Select the correct usb device, generally the last item in the list. Note that if all the items in the list start with hda the computer you're currently using can't be booted from a usb device and you'd be installing grub to a partition of your harddrive instead.

Now copy the dyne/ dock directory from your current system

[d:b] ~ # mkdir /mnt/usb/dyne [Enter]
[d:b] ~ # rsync --inplace -Pr $DYNE_SYS_MNT/* /mnt/usb/dyne/ [Enter]
Rsync is better than cp and we have a progressbar for this operation, which will take quite some time, depending if you have a USB 1.0 or 2.0 connection.

It should be all ready at this point, so try booting your USB device on a computer which supports USB booting. If it works, great! If not, open your /boot/grub/menu.lst (on the USB device) and change the root(...) line from (hd0,0) to (hd1,0).