installing tiny core on a usb drive - the ext2 way

Download Installing Tiny Core on a USB drive - the ext2 way

If you can't read please download the document

Upload: doru-barbu

Post on 23-Jun-2015

200 views

Category:

Documents


1 download

DESCRIPTION

A guide on how to install Tiny Core Linux to an ext2 formatted USB drive

TRANSCRIPT

== Installing Tiny Core on a USB drive == == the ext2 way == a guide by Fragilematter In this tutorial I will wal you through installing Tiny Core Linux on a USB drive in a way that will enable it to maintain top speed while including useful features li e persistence and low RAM usage.

* Getting the goods. Since we're tal ing Tiny Core here, we might as well start with getting the ISO image that will form the base of our fresh USB drive installation. The latest version can always be found at: http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/3.x/release/tiny core-current.iso Just get it with wget or something, it's a small download. With that ta en care of, it's time to prepare the USB drive. * Preparing the USB drive. I'm assuming that the USB drive you'll be installing to is a spare one that you have laying around. If that's not the case, bac up everything from it, since the next step _WILL WIPE IT CLEAN_. Also, all the following utilities require super-user permissions, so you will either have to prefix their respective commands with "sudo", or just go with "su" once. With the drive firmly inserted into a USB port, you'll want to umount it. Then open a terminal and, replacing X with the appropriate letter, do a: fdis /dev/sdX Fdis will open and will present you with an interactive mode that requires you to enter one letter commands. I will further write these commands in this form: [C], meaning that you'll press the "c" ey then Enter. First up, we will disable DOS compatibility, since it's of no use to us or to Tiny Core. Enter [C], and fdis should reply with "DOS Compatibility flag is not set." Then press [U], so that everything will be displayed in sectors instead of cylinders {EW!}. With that out of the way, we want to ma e sure that the partition table on the USB drive is in order, and we'll do that with [O]. That should return "Building a new DOS dis label with dis identifier {some hex value}." Now that we're all set up, it's time to create the ext2 partition that will receive our fresh Tiny Core setup. To do that, enter [N], then [P], then [1]. For the first sector and last sector inputs, just confirm the default values by pressing Enter. This whole series of commands created for us a primary partition that covers the whole drive. A couple more commands, and we'll be done with fdis . We'll want to set the partition type to 83, to mar it as a Linux partition. That can be achieved with [T] followed by [83]. Then we'll mar the partition as active by pressing [A], then [1]. This way the systems that will be booting from the USB drive

* Prerequisites: - an existing Linux system with fdis - an USB drive >= 128MB;

and extlinux;

will now on what partition to loo for the files - partition 1 in our case. That pretty much concludes the fdis step, so we'll write everything to dis by pressing [W]. Fdis should say "The partition table has been altered!", then quit. Now we have a USB drive with a neat partition, but we have no filesystem. Time to create one: m fs.ext2 -L "tc" /dev/sdX1 Of course, replace X with the appropriate letter for the USB drive. The m fs.ext2 command just created an ext2 filesystem on the partition, and labeled it "tc". Now the most comfortable step to have the partition mounted and to ma e sure that the ernel is up to date with the modifications we made is to run eject sdX then pop the USB out of the port and insert it bac . By now your des top environment should have automagically mounted the partition to /media/tc. I will assume that is the case, so all the following commands will reflect that situation. If it's different in your case, alter them accordingly. * Getting TinyCore on the USB drive Now that we have a clean base for our install, it's time to proceed. To place the required files on there, we'll first need to access them, by mounting the ISO image. Easy, right? mount -o loop -t iso9660 tinycore-current.iso /mnt This made the contents of the ISO image accessible in the /mnt folder. Now to copy them onto the USB partition: cp -R /mnt/boot /media/tc/ We're done with the ISO image, so we might as well get rid of it. umount tinycore-current.iso rm tinycore-current.iso We have the files on the USB drive, but they came from a CD, so the bootloader configuration is tailored for CD media. Let's fix it: cd mv mv rm /media/tc/boot/ isolinux extlinux extlinux/isolinux.cfg extlinux/extlinux.conf extlinux/isolinux.bin

You may have noticed "extlinux" pop up in those commands. That is the bootloader we're gonna use. We could have used grub, but I don't thin the added complexity is really warranted in our simple boot case. We won't be ta ing care of the bootloader install right now, we'll leave that for last. We also need to ma e a couple of directories that Tiny Core needs: m dir -p /media/tc/tce/optional m dir /media/tc/opt

What we will ta e care of is tuning the boot parameters so that Tiny Core will now what devices to use and how to use them for maximum performance. As you'd expect, the drive designation won't stay the same as the USB drive is used on different computers, so we need another way of referring to it instead of /dev/sdX1. Luc ily, when we formatted the partition, it also received a unique identification in the form of a long alphanumeric string. To find out that string, we need to run: bl id -s UUID /dev/sdX1 This command will output something along the lines of /dev/sdX1: UUID="{some long string}" - copy the UUID= part, because we will need it in this next step. Now open extlinux/extlinux.conf in your favorite text editor. This file contains several lines that detail what ernel to use and how that ernel should be started. We are interested in the "append initrd={...} line. To this line we are going to add several things: waitusb=5 tce=UUID="..." restore=UUID="..." home=UUID="..." opt=UUID="..." Note that you will need to insert the actual UUID string that you obtained from the bl id command instead of "...". Also, the file might be read only, but that can be quic ly fixed with a "chmod +w extlinux.conf" Let's go over the added tags: - waitusb=5 tells tiny core to wait for 5 seconds before searching for USB devices. This might be needed in case the drive isn't detected that fast. You're free to try smaller values, or remove the waitusb bit completely. However, I advise you to eep it for compatibility reasons. The other four parameters (tce, restore, home, opt) tell Tiny Core to store pac ages on the USB drive, to loo for bac -ups in there and, finally, to place the home and opt folders on that same partition. Additionally, you might want to add some other parameters. You can read all about those in the extlinux folder, by opening the text files named "f2" and "f3". We're almost done, it's time to add that missing bootloader. Assuming that you have syslinux/extlinux installed, it's just a matter of running extlinux -i /media/tc/boot/extlinux This doesn't output much, but it does give us an info that we'll use in the next step: "/media/tc/boot/extlinux is device /dev/sdX1". Remember that "/dev/sdX" part. With that we've ta en care of the partition boot sector, but that doesn't mean that the USB drive's master boot record is as we want it to be. Again, assuming that you have syslinux installed, you can fix that quic ly: cat /usr/share/syslinux/mbr.bin > /dev/sdX where "/dev/sdX" is the device that was identified by extlinux. Also note that the trailing "1" was omitted, since we are referring to the whole USB drive, not the first partition. That's it, we're mostly done. The Tiny Core install is ready, all you need to do now is ma e sure all the data has been written to dis , then you can reboot and ta e it for a spin: cd / eject sdX

reboot * Finishing notes Once you have booted your fresh new TinyCore install, you should edit the /opt/.filetool.list text file, and remove the "home/" line. That way, you won't end up with large quantities ofduplicate copies of files on the partition and in the bac -up when you shutdown the system. This tutorial covers only a small portion of what you can do with Tiny Core. If you want to do more complex things, read up on what can be achieved with this operating sistem at http://tinycorelinux.com/. Also, the wi i has quite a lot of valuable information - http://wi i.tinycorelinux.com/ti i-index.php