create your own

Installing Kurumin 7 (and other distros) on a Pendrive or card

72
rate or flag this page

By Ancillotti


The flash memory cards devices have always been expensive, restricted to palmtops and devices shipped, and even there, almost always in small quantities, when combined with RAM or ROM (cheaper). Most palmtops, you will find a small amount of flash memory, which stores the operating system and a larger amount of SRAM memory, which will be used by the system, stores all the applications and files. Only recently a significant number of palmtops is now using flash memory as a primary means of storage.

The flash memory is a type of solid state memory consists of cells that "trap" an electrical impulse, preserving it for years without need for power. Only energy is needed the time to read or write data.

Why not have moving parts, the mechanical strength is very good. If you begin to mercilessly beat your computer, the memory card would probably be one of the last components to be damaged;).

The limitations of flash memory are the cost per megabyte and a relatively short lifetime, estimated at 1 million cycles to read or write, which restricts its use in some areas. You should never use a flash memory card to store a swap partition, for example.

The cost per megabyte always be much higher than a HD. The difference is that the unit cost of HD is more or less fixed, while a Pendrive or card the cost is proportional to capacity. No HD (new) cost us less than $ 80, what evolves is the capacity. Furthermore, in February 2007, an SD card of 2 GB can now be purchased for U.S. $ 80 and less than a HD.

Since the beginning of the millennium, the cost flash memory has dropped by half every year, crushed by improvements in the manufacturing process and new technologies that allow each cell to store more than move a bit. Currently, the flash memory costs far less now that the RAM and start to replace the HDs in some niches, where the portability and low power consumption are important. Moreover, the memory cards quickly replacing floppy disks as the storage medium, today almost everyone has one:).

The most recent of the motherboard are able to boot Pendrive or through a card reader plugged into the USB port, like a removable HD. On Linux, these devices are detected as if they were SCSI HDs: a Pendrive is detected as "/ dev / sda" and a player with multiple ports, each type of card is seen as a different device. In mine, for example, the SD card is seen as "/ dev / sdc", the compact-flash card is seen as "/ dev / sda" and memory-stick as "/ dev / sdd.

There are also adapters that allow you to connect a compact-flash card directly to one of the IDE ports of the motherboard, making it is detected as a HD. In this case, it will be detected by the system as "/ dev / hda" or "/ dev / hdc", for example.

The novelty is that you can install Linux on Pendrive or card and to boot directly through it. You can use this idea for a portable system that can move to anywhere, or to mount micros without HD, which use flash memory as storage media.

There are two options. You can install directly in the system Pendrive, like a HD, or install the image of a live-CD, as Kurumin or Damn Small, and use the surplus space to store files.

Making a site "real" is the simplest option. You need only choose a reasonably current distribution, the installer is able to detect the Pendrive and do a normal installation, partitioning and installing. Moreover, this is the most expensive option, because the installed system consume much more space than the compressed image used on the CD.

A second problem is that the facility serve only for the PC used during the installation. Where would you use in other micro Pendrive, you have to reconfigure the system to work in the new configuration, a nice little work :-).

The second option, install the image of a live-CD, is more economical in terms of space and allows using the Pendrive in several different micros, as the system detects the hardware during the boot and to run from the CD. If you have a Pendrive or 2 GB card, can run almost any live-CD distribution, but still over 1 GB of free space to store files. You can also remastered the CD in order to make the system more lean, or use a more compact, like Slax or Damn Small.

I use the example of Kurumin 7, but this recipe can be used in Knoppix and (with minor adjustments) in almost any other distribution in live-CD.

To enhance compatibility, we use grub as boot manager. It offers a good flexibility and is less compatibility issues with various cards. Note that only the motherboard actually relatively recent support boot via USB port. Many come to offer the option in setup, but fail at the time H.

This recipe really works. If you follow all the steps correctly and still receive a "Grub: Disk error" or "Error 21", the problem is probably with the BIOS of the motherboard. In some cases, update the BIOS can resolve, but in others you will have to wait until you can switch plate.

The problems of compatibility are exactly the main problem of pendrives bootáveis, if you want something that works in any microwave, it is better to continue using the CD-ROM: p.

Start the partitioning Pendrive. You can also use a card using a USB reader. Both are recognized by the system the same way. If you have a Pendrive 2 GB of the ideal is to let a FAT partition at the beginning, to save files and create a partition of 600 MB or 700 (according to the size of the distribution that is used) for the image of the system. The FAT partition at the beginning allows you to continue accessing the Pendrive normally through Windows.

The image of Kurumin 7 is 604 MB. As we need some additional space for files and grub always some space is lost to the format, we recommend creating a partition of 650 MB for the system. When you use other distributions, calculate the space required in accordance with the size of the system.

The pendrives has been formatted at the factory with a large FAT partition. You can use gparted to resize it and create a EXT2 partition for the system. Naturally, you can use another file system, but the EXT2 is sufficient for what we need.

Pendrive for a 2 GB, would therefore be:

sda1: 1.3 GB (FAT) 
sda2: 650 MB (EXT2)

To format the partition by the terminal, use the commands:

# Mkfs.vfat / dev/sda1 
# Mkfs.ext2 / dev/sda2 
(where / dev / sda refers to the device Pendrive)

The first step is to mount the CD-ROM or ISO file system and copy all files into the second partition of the Pendrive, leaving it with the same structure of folders to the CD-ROM:


Originally, the Kurumin uses isolinux as the boot manager to run through the CD. Although can be used by the isolinux has many limitations in relation to other media, so we replace it with the grub. For this you will need to have Kurumin 7 installed on a partition on the HD.

Give the boot installation of Kurumin. Mount the second partition of the Pendrive and create the folder "/ boot / grub"within it. Then copy the files in pa sta "/ boot / grub" of the legislation calls Kurumin in HD for the folder / boot / grub "of Pendrive, you just created. Also create a blank text file called" test "( folder "/ boot / grub" from Pendrive), which use in the next step.

In the end you will have a structure like this in Pendrive:

Simply copy the files into the grub Pendrive not enough. We now need to install grub in boot sector of the Pendrive, so it becomes bootável. For this, use the prompt of grub. To access it use (from the installation of Kurumin 7 in HD) the command "grub" (as root). You'll see a prompt like this:

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[Minimal BASH-like line editing is supported. For the first word, TAB 
lists possible command completions. Anywhere else TAB lists the possible 
completions of a device / filename. ]

grub>

Grub uses a peculiar nomenclature to name the drives. It is here that the file "test" in the vacuum will be useful. We can use it to discover how grub identified the Pendrive. For this, use the command "find / boot / grub / test" in the grub ompt pr:

grub> find / boot / grub / test

(hd1, 1)

The response indicates that (in the nomenclature used by grub) the file was found in 1 of partitions hd1. Grub appointing devices and partitions from zero, so this amounts to the second partition, the second HD, or the second partition of the Pendrive:).

Need now only install grub on the partition indicated. Watch this step, install the device as wrong can be disastrous:).Use the command "root (hd1, 1)", "setup (hd1)", "setup (hd1, 1)" and "quit", replacing the address, if different in your case. Note that grub installed twice, one in the root of the Pendrive and another on the partition. This is not really needed (install in the root is enough), I just desencargo by:

grub> root (hd1, 1)

Filesystem type is ext2fs, partition type 0x83

grub> setup (hd1)

Checking if "/ boot/grub/stage1" exists ... yes 
Checking if "/ boot/grub/stage2" exists ... yes 
Checking if "/ boot/grub/e2fs_stage1_5" exists ... yes 
Running "embed / boot/grub/e2fs_stage1_5 (hd1 )"... 15 sectors are embedded. 
Succeeded 
Running "install / boot/grub/stage1 (hd1) (hd1) 1 +15 p (hd1, 1) / boot/grub/stage2 / boot / grub / menu.lst" ... succeeded 
Done.

grub> setup (hd1, 1)

Checking if "/ boot/grub/stage1" exists ... yes 
Checking if "/ boot/grub/stage2" exists ... yes 
Checking if "/ boot/grub/e2fs_stage1_5" exists ... yes 
Running "embed / boot/grub/e2fs_stage1_5 (hd1, 1 )"... failed (this is not fatal) 
Running "embed / boot/grub/e2fs_stage1_5 (hd1, 1 )"... failed (this is not fatal) 
Running "install / boot/grub/stage1 (hd1, 1) / boot/grub/stage2 p / boot / grub / menu.lst" ... succeeded 
Done.

grub> quit

At this point, you have a structure similar to that in Pendrive:

/ boot / grub 
/ boot / isolinux 
/ KNOPPIX

The folder "/ boot / isolinux" contains the original boot files from the system (as the kernel and initrd.gz file), while the folder "/ KNOPPIX" contains a compressed image of the system. The next step is to adapt the copy of grub that created to use these files.

Access from "/ boot / grub" (No Pendrive) and delete the file "device.map", it contains a cache of devices available on the machine, which deleted the grub to detect everything every boot, as will Pendrive used in several different machines.

Now open the file "menu.lst". Delete all its contents and replace the lines below:

default 0 
timeout 9

title Kurumin Linux 
root (hd0, 1) 
kernel / boot/isolinux/linux26 ramdisk_size = 100000 init = / etc / init quiet vga = 791 lang = us 
initrd / boot / isolinux / minirt.gz

BOOT title by HD 
root (hd1) 
chainloader +1

Regardless of how grub has detected the Pendrive in the previous step, when you boot it through it, when the grub sees as "(hd0)". The system is installed in the second partition, which leads us to address "(hd0, 1), we use the option key, responsible for loading the system installed on the Pendrive. If you are using a single partition on Pendrive, replace the "(hd0, 1)" with "(hd0, 0)"

Note that the options "/ boot/isolinux/linux26" and "/ boot / isolinux / minirt.gz" indicate the location of the kernel image and initrd file to be used. The name of the file may change from distribution to distribution, so it is always important confirm.

The second option (the title BOOT HD) offers the option to boot normal one, loading the system installed in HD, you need not remove the Pendrive.

With this, you already have a card or Pendrive bootável, simply configure the setup to boot through it and test. Look for the "First Boot Device" and configure it with the "Generic USB Flash", "USB-HDD" or "Removable Devices", in accordance with what is available. Some cards (even some relatively new models), are problematic in relation to the boot through pendrives. In a Asus A7N8X-X that tried, for example, Pendrive was only detected by the BIOS if the option "APIC Function" (which has nothing to do with the story) is enabled

One trick is that the BIOS only supports booting via Pendrive if you enable the flag "bootable" for the partition (from Pendrive) which saved the image of the system. Without it, the boot to a message claiming that the device is not bootável.

To do this through gparted, right-click on the partition "/ dev/sda2" and visit the "Manage Flags". Menu, select the option "boot":

With cfdisk, select the partition and activate the option "[Bootable]. Initially the boot screen is very simple, containing only a text menu with two options defined in the file "menu.lst", but you can improve it by adding a background image or color. The visual setting does not change for a normal installation of grub.

What is interesting is that this can be done with other devices compatible with the standard usb-storage (where the card is seen by the system as a Pendrive) as cameras and even palms. That is, a card with enough capacity, your camera can, and take pictures and store files, serve as system boot.

One more important detail is related to the speed of the USB port and also the speed of Pendrive, card or camera used.The USB 1.1 ports have a transfer rate limited to around 800 KB / s, which makes loading the system slow, almost as if that boot from a CD-ROM 6x.

The USB 2.0 ports are much faster, so that is limiting the speed of the card or Pendrive used. The recent manufacturing usually has a reading speed of between 20 and 40 MB / s, which already provides a satisfactory performance.

The big problem is because of some cameras and pendrives old, where the transfer rate is very low, often less than 300 kb / s. Nothing prevents you from using them, but system performance is very bad.

Print   —   Rate it:  up  down  flag this hub

working