WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Booting tinycore.iso from an USB stick  (Read 46039 times)

Offline SvOlli

  • Full Member
  • ***
  • Posts: 193
  • Linux Developer
Booting tinycore.iso from an USB stick
« on: July 03, 2011, 04:28:32 PM »
Hello,

I've had some discussions lately on howto install Tiny Core Linux on a machine that doesn't have a CD-ROM drive. Here's a small howto on chain-booting an ISO-image.

First of all you need GRUB4DOS. Despite the name, it doesn't need DOS.

You can download it on Tiny Core using this command:
Code: [Select]
tce-load -wi grub4dos
When your stuck with an Linux distro or Windows, so you'll need to download the package:
https://code.google.com/p/grub4dos-chenall/downloads/list

On Windows you'll also need another tool to write the first stage boot loader. It's in the package grubinst-1.1-bin-w32-2008-01-01.zip, available here:
http://download.gna.org/grubutil/

1. Format the USB stick with a partition using FAT12/16/32, NTFS or EXT2/3 (not EXT4)
You create the first stage boot loader on a Linux system running bootlace.com:
Code: [Select]
./bootlace.com --time-out=0 /dev/of_usb_stick (like /dev/sdb, not /dev/sdb1)
2. Copy the file "grldr" at the root of that partiton. And copy the tinycore-iso file to that same place and rename it to "tinycore.iso".

3. Create a file "menu.lst" at the same place containing this:
Code: [Select]
find --set-root /tinycore.iso
map --mem /tinycore.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

After these steps, booting from the USB stick should give you the familiar boot screen from Tiny Core Linux.

Greetings,
SvOlli

P.S.: Why do people still keep using syslinux/isolinux/extlinux/pxelinux? ;)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Booting tinycore.iso from an USB stick
« Reply #1 on: July 03, 2011, 04:47:45 PM »
Hi SvOlli
I thought EXT3 is a journaling file system, and that it should not be used on a USB stick.

Offline SvOlli

  • Full Member
  • ***
  • Posts: 193
  • Linux Developer
Re: Booting tinycore.iso from an USB stick
« Reply #2 on: July 03, 2011, 04:59:53 PM »
It was stating what is technically possible using the first stage loader, not what is sane to use on a USB stick. NTFS is also a journaling file system.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Booting tinycore.iso from an USB stick
« Reply #3 on: July 03, 2011, 05:14:53 PM »
Hi SvOlli
Since this is being offered as a  how to  and might be used by someone who is unaware of it, I will
state it.

Do not use a journaling file system on a USB stick or any flash storage medium. It will cause it to
wear out prematurely.

Offline Guy

  • Hero Member
  • *****
  • Posts: 1089
Re: Booting tinycore.iso from an USB stick
« Reply #4 on: July 03, 2011, 05:26:37 PM »
It is also not ideal to use a FAT12/16/32 filesystem, as you have a greater likelihood of filesystem corruption.

It is ideal to use ext2.


It is also about free choice. For example, some people may use a journalling filesystem, Knowing that the drive may not last as long. USB drives are not that expensive to replace.
« Last Edit: July 03, 2011, 05:31:13 PM by Guy »
Many people see what is. Some people see what can be, and make a difference.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Booting tinycore.iso from an USB stick
« Reply #5 on: July 03, 2011, 06:42:35 PM »
Hi Guy
My post was not made to take away free choice, just to allow someone who is unaware of the possible
consequences to make an informed choice. They are, as always, free to ignore my advice.

Offline Guy

  • Hero Member
  • *****
  • Posts: 1089
Re: Booting tinycore.iso from an USB stick
« Reply #6 on: July 03, 2011, 07:07:04 PM »
Not trying to suggest that you were.

It is good that you let them know.
Many people see what is. Some people see what can be, and make a difference.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Booting tinycore.iso from an USB stick
« Reply #7 on: July 03, 2011, 09:04:29 PM »
Hi Guy
Fair enough. I misunderstood the message.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Booting tinycore.iso from an USB stick
« Reply #8 on: July 19, 2011, 12:58:14 AM »
I use gru4dos exclusively now (due mostly because of the lack of support or bug for older systems in isolinux/syslinux v4) now that i've found how versatile grub4dos is I can't ever see going back to anything else.


I agree ext2  works best on all nand drive/sticks

Offline meo

  • Hero Member
  • *****
  • Posts: 651
Re: Booting tinycore.iso from an USB stick
« Reply #9 on: July 28, 2011, 01:29:51 PM »
Thanks SvOlli!

I've tried with ext2fs and fat32 and it works  perfectly. I like the ease of updating to the most current as the only thing that has to be done is to download TC and rename it to tinycore.iso and off you go. Thanks again for sharing this!  :)

Have fun tweaking TC to your liking,
meo
"All that is very well," answered Candide, "but let us cultivate our garden." - Francois-Marie Arouet Voltaire

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: Booting tinycore.iso from an USB stick
« Reply #10 on: August 02, 2011, 10:17:03 AM »
I've had some success extending the OP method (thanks SvOlli).

The Main Goals:
1. Supply bootcodes via the bootloader in the usual TC manner
2. Reduce time GRUB4DOS takes to access the TC ISO
3. Produce a simple to maintain USB flash drive, able to boot multiple OSs via ISO

I managed to achieve 1 and 3, and hope progress might be possible on 2 with help from the Core team.

The following method illustrates how to create a USB device that directly boots ISOs and images via different GRUB4DOS methods.[1]

What is needed:
Tools
* dosfstools.tcz
* grub4dos.tcz
* mke2fs (provided by default in standard TC)

ISOs and Images
* Tinycore ISO (tested with v3.7.1 - 10MB - uses mapping to memory) [2]
* UBCD ISO (tested with v5.1 - 352MB - uses direct mapping) [3]
* Balder10 IMG (FreeDOS floppy disk from Finnix - 1.4MB uses direct mapping) [4]

Storage
* USB flash drive (suggest size=1GB for demo)

Prepare the USB Flash Drive [5]
* Blank the start (or all) of the device
* Create 2 partitons
   sdx1=FAT16 size=500MB (for ISO/IMG storage) [6]
   sdx2=ext2 size=all remaining space (for TC data storage)

Prepare the ISOs and Images
* Ensure the files are named:
  tinycore.iso
  ubcd51.iso
  balder10.img

Store the ISOs and Images
* Mount /mnt/sdx1
* Copy the files to /mnt/sdx1

Make the USB Device Bootable
* Copy /usr/local/share/grub4dos/grldr to /mnt/sdx1
* Create the following text file /mnt/sdx1/menu.lst [8]
Code: [Select]
# menu.lst displays a menu when booting via GRUB4DOS
# http://diddy.boot-land.net/grub4dos/Grub4dos.htm

timeout 5
default 0
color cyan/black black/light-gray green/black yellow/black

# 0
title Tinycore Desktop (Mount Mode, Persistent Extensions, /home, /opt)
root ()
map --mem /tinycore.iso (hd32)
map --hook
root (hd32)
kernel /boot/bzImage quiet waitusb=5 norestore tce=UUID=uuid-of-sdx2 home=UUID=uuid-of-sdx2 opt=UUID=uuid-of-sdx2
initrd /boot/tinycore.gz

# 1
title UBCD Toolkit (inc Clonezilla, MHDD, Parted Magic)
root ()
map /ubcd51.iso (hd32)
map --hook
chainloader (hd32)

# 2
title Balder10 FreeDOS (Defrag FAT16 Partition)
root ()
map /balder10.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
map --floppies=1

* Unmount /mnt/sdx1
* Create a Master Boot Record on the USB Device
   /usr/local/share/grub4dos/bootlace.com --time-out=0 /dev/sdx


Notes:
[1] GRUB4DOS has two methods of accessing an ISO or image file.  Mapping to memory is the slowest and is best suited to small files.  Direct mapping is almost instantaneous and suited to both small and large files.  
[2] http://distro.ibiblio.org/tinycorelinux/downloads.html
[3] http://www.ultimatebootcd.com/download.html
[4] http://www.finnix.org/Balder
[5] The method assumes the USB device to be /dev/sdx, change this to the actual value.
[6] Direct mapping requires that the file occupies contiguous disk space.  The developer of GRUB4DOS has indicated that ext2/3 may not be the best choice for this.  Balder10 includes a defragmenter for FAT16.
[7] Defragmenting sdx1 might also be done by copy out of files from sdx1, reformat sdx1, return files to sdx1.
[8] Replace uuid-of-sdx2 with the actual UUID value


Outcome
I have other ISOs and images that might have been illustrated but felt that too many examples might not be helpful.   Adding another ISO or image is a simple matter of dropping it into the root of sdx1 and adding an entry in menu.lst. Updating is just a matter of replacing the old ISO or image file with a newer one.  

TC can be started with the preferred bootcodes automatically provided by the boot loader.  Its usual persistent directories are maintained on a separate ext2 file system - transparently from the user viewpoint.

Tinycore can only be made to operate using the map --mem method.  This prolongs the overall loading time as the ISO must first be read into memory before TC starts to load.  UBCD and Balder are much larger and smaller respectively than TC.  Both begin loading faster than TC as a result of using the direct mapping mode. This is where the Core team might be able to help obtain a TC ISO that can be booted via direct mapping.


Edit
Incorrectly stated achieved goals 1 &2.  Corrected to achieved goals 1 & 3.
Corrected some typos.
Minor amendments to improve clarity.
« Last Edit: August 04, 2011, 03:38:58 AM by SamK »

Offline meo

  • Hero Member
  • *****
  • Posts: 651
Re: Booting tinycore.iso from an USB stick
« Reply #11 on: August 05, 2011, 04:54:08 AM »
Hi Y'all!

I have problems with one of my USB Flash Drives. When I issue the bootlace command i get the message "Invalid partition table ...". Can someone give me a hint how to make it work? Thanks beforehand!

Have fun using TC,
meo
"All that is very well," answered Candide, "but let us cultivate our garden." - Francois-Marie Arouet Voltaire

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Booting tinycore.iso from an USB stick
« Reply #12 on: August 05, 2011, 04:59:41 AM »
Repartition. Use fdisk, part of base.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline meo

  • Hero Member
  • *****
  • Posts: 651
Re: Booting tinycore.iso from an USB stick
« Reply #13 on: August 05, 2011, 05:10:29 AM »
Thanks bmarkus!

I just tested the USB Flash Drive (2 GB) formatted in ext2fs and got another error message: "No boot signature(55 AA). Must specify floppy --floppy explicitly for floppy." I just have to make another repartition I guess.

Have fun trying the limits of TC,
meo
"All that is very well," answered Candide, "but let us cultivate our garden." - Francois-Marie Arouet Voltaire

Offline Guy

  • Hero Member
  • *****
  • Posts: 1089
Re: Booting tinycore.iso from an USB stick
« Reply #14 on: August 05, 2011, 09:57:41 PM »
Try deleting the partition, and creating a new one.

You can use fdisk, as already mentioned.

Another option is to use GParted which can be installed in Tinycore, or run from Parted Magic.

If you use fdisk, you need to format the partition as well. GParted does it automatically.
Many people see what is. Some people see what can be, and make a difference.