Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: 3rail on September 28, 2009, 01:30:50 PM

Title: recommendations for a flash based TC installation?
Post by: 3rail on September 28, 2009, 01:30:50 PM
Anyone have any recommendations for how to set up TC when using flash based media as the primary medium? (I heard something about minimizing writes to the drive?)

Title: Re: recommendations for a flash based TC installation?
Post by: robc on September 28, 2009, 04:03:25 PM
When using a flash device it is recommended to minimize your write cycles due to their relatively low limit. TC already gives you many solutions for this. The biggest being that the TC base operates completely in RAM, therefore you have a complete working system that you did not have to write to the disk in order to get started and the disk does not need to remain mounted.

But you probably want to have extensions loaded. The best way would be to put them into the iso by remastering TC. There are some instructions in the wiki for this. The benefit of this is you can umount your drive and don't have to worry about data corruption on the flash drive when there is a power failure. The drawback is it makes it hard to update and uses more write cycles to update the iso then it would if only updating the extensions. If you are building a system for embedded or server purposes then I would recommend the remaster.

Though, if you are using this for everyday desktop use then you would want to use TC more or less normally. Just create a tce and tce/optional directories in the root of the flash drive, then cp your desired extensions there. You can either install the extensions to RAM or mount them. The flash drive/disk will need to remain mounted if the extensions are mounted. Just make sure the backup flag is not checked when shutting down and only backup if/when you need to.
Title: Re: recommendations for a flash based TC installation?
Post by: Guy on September 29, 2009, 01:52:37 AM
USB drives can only be written to a limited number of times, and then they will not work, normally many thousands. Newer usb drives normally last longer than earlier ones.

Use the Ext2 filesystem.

If you select "USB Installation" from the menu, it will be set up that way (there are other options).

Ext2 is a non-journalling file system.

When a non-journalling file system is used, the computer writes a file to the drive, then writes a record of what it has written. If a power failure or malfunction occurs before it has finished, the computer may have something partly written, but not have a record of what it is. As a result, the drive may contain lost fragments of files.

If a Journalling filesystem is used, the computer writes in a journal what it intends to write, then writes the file, and when it has finished, writes a record of what it has written. As a result, if a power failure or malfunction occurs before it has finished, there is a record of what this partly written file is. If the complete file has been written, but not the record, the computer corrects the record. If the complete file has not been written, the computer restores the file to how it was last saved before the power failure or malfunction. As a result, the drive does not contain lost fragments of files.

Ext3 and Ext4 are journalling filesystems.

Some people prefer to use journalling filesystems on usb drives to avoid the risk of lost files.

Do not make a swap partition on the usb drive. Make it on the hard drive.
Title: Re: recommendations for a flash based TC installation?
Post by: tclfan on September 29, 2009, 01:06:09 PM
A quick question:  Is Ext2 or Ext3 journalled file system actually helpful on usb key? Where does the journal reside? Is it also on the usb key file system, so the broken file can be recovered?
I believe that when you run 'usbinstall' process and create an usb bootable tc, the default fs is FAT32 on both partitions (ZIP emulation)...
Title: Re: recommendations for a flash based TC installation?
Post by: Guy on September 29, 2009, 03:05:42 PM
When running "USB Installation", to have an Ext2 filesystem, you need to type "e" for Ext. The other options are different.

Ext2 is a non-journalling filesystem. Ext3 and Ext4 are journalling filesystems.

FAT16 and FAT32 are non-journalling filesystems.

When using a Linux filesystem (Ext2, Ext3 and Ext4), every directory and file belongs to an owner and group, and has permissions, which may be a combination of read, write and execute.

When using a FAT16 or FAT32 filesystem, each directory and file does not belong to an owner and group, or have permissions.

As a result, no file in a Linux filesystem can be modified without appropriate permissions. This makes Linux much more secure against viruses, and general filesystem corruption. (Other types of malware can affect Linux. It needs to overcome this permission barrier.)

People who run Linux (or Windows) on a FAT16 or FAT32 filesystem will report that after awhile the filesystem becomes corrupted, and they need to reinstall the operating system.

This is much less of a problem when running Linux on a Linux filesystem.

The big advantage of a Linux filesystem on a usb drive is the owner and group, and permissions.

People have different opinions as to whether a journalling filesystem or non-journalling filesystem is better on a usb drive. Decide for yourself.

I recommend installing operating systems on hard drives, not usb drives, as hard drives do not have the same limited life. Use a journalling filesystem on the hard drive.

Even if running another operating system as well, most people will have enough space on the hard drive to create an Ext3 partition and a swap partition to use for Linux (those with small hard drives may not). Some people just don't understand how to do it.

Another way of looking at it, usb drives are becoming relatively inexpensive. If you understand that you will need to replace the usb drive after some time when it malfunctions, and you are happy doing that, go ahead. You may lose files when it malfunctions.
Title: Re: recommendations for a flash based TC installation?
Post by: roberts on September 29, 2009, 04:42:45 PM
Tiny Core/Micro Core are ideal for flash based systems. I hve been running almost exclusively flash for several years. Originally with CF/IDE adapters when developing for my former project. But let me explain in more detail.

Recall the preferred method of operation is PPR. What follows is with the assumption of running Core with a PPR, i.e., a 'tce' directory.  It is simple to initially setup a PPR, just use a one time only boot code of tce=hdXY. Where X is typically 'a' for the first drive, 'b' for the second, and so on, and where Y is '1' for the first partition, '2' for second, and so on. By doing so, a 'tce' directory is created and all extensions will be stored there. Upon subsequent bootings the extensions are read from this directory and either loaded into RAM or mounted and symlinked into the OS. The OS resides entirley in RAM.

What does this mean in relation to flash type devices? As I pointed out in Core Concepts, the extensions are WORMS. Write Once Read Many, Write once, the download into the tce directory, read many, each boot they are read. Therefore, using a PPR is extremely flash friendly, as only one write. It is only the write cycles that count. Reading from flash is fast and virtually no impact.

It is the reason that I have separated the extensions into a separate directory. It is the reason that I frequently remind users to separate static from dynamic content. Static, unchanging data, can easily be made into a worm, err, extension. Being static means write it once, read it often.

Dynamic data, typically items in your home directory that you are currently working on are dynamic data. Still I recommend doing a backup, as it is friendlier for flash, than using a persistent home. Keeping control of your backup size can be a challenge but so worth it. For example do not backup cache and logs. Doing a backup on a flash device, is like using the flash device as a super fast floppy. But in reality the the limited flash write cycles far outlast that of the former floppy drive. Lets say the write cycle lifetime is 10,000 writes. Lets day you backup five times a day, each and every day of the year. That works out to... 10,000 / (365 *5 ) over 5 years. We all know technology will improve vastly before five years. And we all know ow cheap technology becomes.  I know that this may be an over simplication of the matter. But the concepts, the core concepts I initially setup was for the optimum use of flash based devices. I rarely use spinning platters anymore.

BTW. There are some real bargins on first generation netbooks with tiny 4GB SSD that are too small for Ubunutu, Xandros with updates and other netbook remixes, and clearly not enough room from Windows XP. Tiny Core runs great on these. I have seen eeePC 900A for 129.00 and even the super luxury eeePC S101 for 279.00. Also the smallest Dell Mini9 for 199.00 are first generation SSD. I have personally seen Tiny Core/Micro Core work on these and operate much faster than the vendor supplied OS offering.

Whether it be pendrive, compact flash, or SSD, Core is friendly when run in PPR mode.

I do not recommend swap on a flash, nor do I the scatter mode installation, i.e, the traditiona hard drive installation. I can see using a second micro SD for persistent home/ and/or opt/.

As always, this is IMHO, and in fact how I run Tiny Core and Micro Core, and YMMV.

Title: Re: recommendations for a flash based TC installation?
Post by: tclfan on September 30, 2009, 06:19:13 AM
Yes, this separation of static content and acting as WORM fits perfectly to put it on usb, particularly the size is so small comparing to bloated systems.
I just want to add that this architecture secures integrity of the static content. Being self-contained and static each time it boot in a pristine, original and uncorrupted state.  This is to me even far greater importance than saving usb write cycles...