Both sides previous revisionPrevious revisionNext revision | Previous revision |
wiki:persistence_for_dummies [2011/04/29 08:11] – [Choosing a different background] jur | wiki:persistence_for_dummies [2013/09/28 03:48] (current) – georgp24 |
---|
=====Overview===== | =====Overview===== |
| |
//Note: You can skip reading anything in parantheses, which are included for clarification.// | //Note: You can skip reading anything in parentheses, which are included for clarification.// |
| |
When you boot Tinycorelinux (tcl) for the first time, such as from CD, the default mode of operation is "cloud mode", meaning all extensions are downloaded from the web for each session. (//Extensions can be apps such as a browser, or hardware drivers, modules, firmware or shared libraries. The extensions are compressed and packaged in files with .tcz extension.//) They are not permanently stored anywhere unless you specifically instruct tcl to do so. Same with settings changes you make - these are not permanently stored by default. | When you boot Tinycorelinux (tcl) for the first time, such as from CD, the default mode of operation is "cloud mode", meaning all extensions are downloaded from the web for each session. (//Extensions can be apps such as a browser, or hardware drivers, modules, firmware or shared libraries. The extensions are compressed and packaged in files with .tcz extension.//) They are not permanently stored anywhere unless you specifically instruct tcl to do so. Same with settings changes you make - these are not permanently stored by default. |
| |
One way of understanding tcl is it consists of just 2 files, one file containing all the linux kernel stuff and the other the tcl-specific stuff. At each boot, these 2 files are unpacked and loaded into your PC's memory (RAM). So at each boot, it boils down to a fresh (lightning fast) install. Goodbye, system rot! | One way of understanding tcl is it consists of just 2 files, one file called vmlinuz containing all the Linux kernel stuff and the other the tcl-specific stuff, named core.gz. At each boot, these 2 files are unpacked and loaded into your PC's memory (RAM). So at each boot, it boils down to a fresh (lightning fast) install. Goodbye, system rot! |
| |
Likewise with extensions, these are each [[http://en.wikipedia.org/wiki/Loop_device|loop mounted]] into a temporary location (///tmp/tcloop//), and linked into the main linux file system, at each boot. So //everything// is installed at every boot. No corruption, ever! Uninstalling apps is rendered completely obsolete - just delete the packed app file, (//xxx.tcz//), and goodbye! No more useless left-behind files cluttering up the OS, ever! Upgrading to newer versions becomes dead simple - replace the older tcz package with the newer one. This is truly a new, unique concept. | Likewise with extensions, these are each [[http://en.wikipedia.org/wiki/Loop_device|loop mounted]] into a temporary location (///tmp/tcloop//), and linked into the main Linux file system, at each boot. So //everything// is installed at every boot. No corruption, ever! Uninstalling apps is rendered completely obsolete - just delete the packed app file, (//xxx.tcz//), and goodbye! No more useless left-behind files cluttering up the OS, ever! Upgrading to newer versions becomes dead simple - replace the older tcz package with the newer one. This is truly a new, unique concept. |
| |
When you shut it down, all of the contents of your PC's RAM is lost, and therefore everything in the entire linux file system as well. At next boot, everything is freshly created from the compressed files again. You can quickly see that tcl is utterly impervious to things like viruses or accidental file deletion - any damage is completely restored with a boot. Goodbye anti-virus! | When you shut it down, all of the contents of your PC's RAM is lost, and therefore everything in the entire Linux file system as well. At next boot, everything is freshly created from the compressed files again. You can quickly see that tcl is utterly impervious to things like viruses or accidental file deletion - any damage is completely restored with a boot. Goodbye anti-virus! |
| |
This basic cloud mode is of course a problem once you decide to keep tcl - you hardly want to download your favourite extensions each time you boot, not to mention lose your own personal preferences and settings such as wifi stuff. Don't despair - tcl has been cleverly designed to save all your settings and extensions while retaining its bullet-proofness. You just have to tell it to do so. This ability to have your stuff saved for a next session is called "persistence." There are a number of entries on "persistence" in the wiki for further explanation. Another name commonly used is "backup". | This basic cloud mode is of course a problem once you decide to keep tcl - you hardly want to download your favourite extensions each time you boot, not to mention lose your own personal preferences and settings such as wifi stuff. Don't despair - tcl has been cleverly designed to save all your settings and extensions while retaining its bullet-proofness. You just have to tell it to do so. This ability to have your stuff saved for a next session is called "persistence." There are a number of entries on "persistence" in the wiki for further explanation. Another name commonly used is "backup". |
===The /tce Directory=== | ===The /tce Directory=== |
| |
If you are not familiar with the linux file system, things may seem a bit confusing. This is not the place to explain all that, but it is handy to know that in Tiny Core Linux, the basic linux file system is used, with all drives with partitions on them and other media that are found by tcl, as subdirectories in ''/mnt''. | If you are not familiar with the Linux file system, things may seem a bit confusing. This is not the place to explain all that, but it is handy to know that in Tiny Core Linux, the basic Linux file system is used, with all drives with partitions on them and other media that are found by tcl, as subdirectories in ''/mnt''. |
| |
The ''/tce'' directory is not a part of the linux file system; instead it is typically in the root of a partition. So if you want to look at the contents, you have to look for it under ''/mnt''. For example, if tcl found a hard drive partition ''sda1'', it is shown as ''/mnt/sda1''. And if ''/tce'' was created on ''sda1'', then you would look for ''/mnt/sda1/tce''. | The ''/tce'' directory is not a part of the Linux file system; instead it is typically in the root of a partition. So if you want to look at the contents, you have to look for it under ''/mnt''. For example, if tcl found a hard drive partition ''sda1'', it is shown as ''/mnt/sda1''. And if ''/tce'' was created on ''sda1'', then you would look for ''/mnt/sda1/tce''. |
| |
(//Note: Partitions are not necessarily mounted by default - you have to mount them using the ''mount'' command, eg ''sudo mount /dev/sda1'', which will result in the device ''sda1'' to be mounted in the default directory of ''/mnt/sda1''. tcl will do this automatically when creating /tce.//) | (//Note: Partitions are not necessarily mounted by default - you have to mount them using the ''mount'' command, eg ''sudo mount /dev/sda1'', which will result in the device ''sda1'' to be mounted in the default directory of ''/mnt/sda1''. tcl will do this automatically when creating /tce.//) |
//**Note: If you decide to use a USB device, you have to use a boot code of ''waitusb=5'' to tell tcl to wait 5s, or longer if required, for the usb file system to be mounted, or it will not find ''/tce'' and you will be running in cloud mode instead.**// | //**Note: If you decide to use a USB device, you have to use a boot code of ''waitusb=5'' to tell tcl to wait 5s, or longer if required, for the usb file system to be mounted, or it will not find ''/tce'' and you will be running in cloud mode instead.**// |
| |
If you created ''/tce'' in the root of a partition, then the boot option is not required afterwards - tcl will scan all found partitions and use the first found ''/tce''. If you want to use another location, for example inside another directory, you have to continue using the boot option to ensure the correct location is found. | If you created ''/tce'' in the root of a partition, then the boot option is not required afterwards - tcl will scan all found partitions and use the first found ''/tce''. If you want to use another location, for example inside another directory, you have to continue using the boot option to ensure the correct location is found. |
| |
| It is not a bad idea to keep using the boot code afterwards, to avoid puzzling results where tcl found a different /tce than the one you were expecting to be used. This will also save some booting time as tcl won't be doing any scanning. |
| |
You can have more than one ''/tce'' location for different purposes, and set up a multi-boot scenario where you can choose which /tce to use for a particular session. | You can have more than one ''/tce'' location for different purposes, and set up a multi-boot scenario where you can choose which /tce to use for a particular session. |
=====Getting tinycore to save your documents and settings===== | =====Getting tinycore to save your documents and settings===== |
| |
Many settings, and all documents, are stored in your home directory called ''/home/tc'' (//also called ''~HOME''//), and ''/opt''. (//''~HOME'' is roughly equivalent to "''Documents and Settings\USER\My Documents''" in Windows.//) If you are not using persistence, by default, these directories are lost at shutdown, so you lose everything. Tiny Core is very flexible and there are several ways to save your documents and settings for a next session. | Many settings, and all documents, are stored in your home directory called ''/home/tc'' (//also called ''$HOME'' or "~" //), and ''/opt''. (//''$HOME'' is roughly equivalent to "''Documents and Settings\USER\My Documents''" in Windows.//) If you are not using persistence, by default, these directories are lost at shutdown, so you lose everything. Tiny Core is very flexible and there are several ways to save your documents and settings for a next session. |
| |
===By using the Backup Utility=== | ===By using the Backup Utility=== |
| |
The default mode of saving your docs and settings is via the backup utility, which comes up when you do a shutdown. This backup utility creates a file called by default ''mydata.tgz'' (//if it doesn't already exist//), which contains your entire ''~HOME'' directory contents, and the ''/opt'' directory, both compressed. The file ''mydata.tgz'' is stored in ''/tce''. So, once you start using the ''/tce'' directory, automatically all your stuff becomes persistent. | The default mode of saving your docs and settings is via the backup utility, which comes up when you do a shutdown. This backup utility creates a file called by default ''mydata.tgz'' (//if it doesn't already exist//), which contains your entire ''$HOME'' directory contents, and the ''/opt'' directory, both compressed. The file ''mydata.tgz'' is stored in ''/tce''. So, once you start using the ''/tce'' directory, automatically all your stuff becomes persistent. |
| |
When booting, tcl will first look for ''mydata.tgz'' in ''/tce'' and then scan partitions until found. If it is not found, an empty default will be created in ''/tce''. You can optionally specify a different location for the backup file with the boot code "''restore=xxx/any/storage/directory''", where xxx is a valid partition, and ''/any/storage/directory'' already exists. | When booting, tcl will first look for ''mydata.tgz'' in ''/tce'' and then scan partitions until found. If it is not found, an empty default will be created in ''/tce''. You can optionally specify a different location for the backup file with the boot code "''restore=xxx/any/storage/directory''", where xxx is a valid partition, and ''/any/storage/directory'' already exists. |
The list of stuff saved in ''mydata.tgz'' is found in a file called ''/opt/.filetool.lst'', while the exclusions are in ''/opt/.xfiletool.lst''. Excluded items take precedence over included ones, so you can include a whole directory and exclude some bulky items from it. | The list of stuff saved in ''mydata.tgz'' is found in a file called ''/opt/.filetool.lst'', while the exclusions are in ''/opt/.xfiletool.lst''. Excluded items take precedence over included ones, so you can include a whole directory and exclude some bulky items from it. |
| |
''~HOME'' can quickly become quite large, and the backup during shutdown and subsequent restore at the next boot can take some time. You can reduce backup times by carefully excluding stuff you don't require to be restored - look for large directories and files to put in the exclude list. There is a utility ''BigHomeFiles'' in the Control Panel to aid in this. There are already some default exclusions from the ''~HOME'' directory such as cache files, to prevent saving any unecessary stuff. | ''$HOME'' can quickly become quite large, and the backup during shutdown and subsequent restore at the next boot can take some time. You can reduce backup times by carefully excluding stuff you don't require to be restored - look for large directories and files to put in the exclude list. There is a utility ''BigHomeFiles'' in the Control Panel to aid in this. There are already some default exclusions from the ''$HOME'' directory such as cache files, to prevent saving any unecessary stuff. |
| |
There are further ways to optimize boot times; static files and directories in ''~HOME'' can be made into extensions - see the wiki for more information on [[wiki:extension_for_settings|creating extensions for settings]]. | There are further ways to optimize boot times; static files and directories in ''$HOME'' can be made into extensions - see the wiki for more information on [[wiki:extension_for_settings|creating extensions for settings]]. |
| |
===By specifying permanent directories for ~HOME and /opt=== | ===By specifying permanent directories for /home and /opt=== |
| |
Another way of saving your stuff, is to tell tcl to use permanent directories for ''/opt'' and ''~HOME'' located on a storage medium. This is also done via boot codes, viz "''opt=sda1''" and "''home=sda1''". These boot codes tell tcl not to create and restore ''~HOME'' and ''/opt'' at boot time from ''mydata.tgz'' as it would otherwise do, but rather to take these directories on the specified permanent storage medium and mount them into the linux file system instead. | Another way of saving your stuff, is to tell tcl to use permanent directories for ''/opt'' and ''/home'' located on a storage medium. This is also done via boot codes, with "''opt=sda1''" and "''home=sda1''". These boot codes tell tcl not to create and restore ''/home'' and ''/opt'' at boot time from ''mydata.tgz'' as it would otherwise do, but rather to take these directories on the specified permanent storage medium and mount them into the linux file system instead. |
| |
If they don't already exist in the specified locations, they will be freshly created there and populated with all the default files. The effect is that these two directories are now located on permanent storage, and anything you change and save there via the normal way is therefore saved immediately, permanently. Since they now exist on permanent storage, you no longer have to backup everything, so you can edit ''.filetool.lst'' and remove these entries from the list to prevent them from being backed up into mydata every time. | If they don't already exist in the specified locations, they will be freshly created there and populated with all the default files. The effect is that these two directories are now located on permanent storage, and anything you change and save there via the normal way is therefore saved immediately, permanently. Since they now exist on permanent storage, you no longer have to backup everything, so you can edit ''.filetool.lst'' and remove these entries from the list to prevent them from being backed up into mydata every time. |
| |
Since ''~HOME'' and ''/opt'' locations are specified individually, you can have them anywhere on your PC - another partition, another hard disk altogether, even a usb stick that you plug in for the session. So you can save all your personal stuff in one place, easily backed up, and when your boot disk crashes or something, you still have all your personal stuff safely somewhere else. You can safely reformat your boot partition should something terrible happen without losing your personal data. Compare this to having your Windows disk crash! | Since ''/home'' and ''/opt'' locations are specified individually, you can have them anywhere on your PC - another partition, another hard disk altogether, even a usb stick that you plug in for the session. So you can save all your personal stuff in one place, easily backed up, and when your boot disk crashes or something, you still have all your personal stuff safely somewhere else. You can safely reformat your boot partition should something terrible happen without losing your personal data. Compare this to having your Windows disk crash! |
| |
The limitation - if you can even call it that - is these directories cannot exist in partitions other than linux ones; Windows file systems do not support file permissions which are a crucial part of this to work. To operate tcl entirely from a FAT partition, for example, you are forced to use the backup system. The ''/tce'' and all its contents do not require file permission information, so can be stored on a FAT partition if required. | The limitation - if you can even call it that - is these directories cannot exist in partitions other than linux ones; Windows file systems do not support file permissions which are a crucial part of this to work. To operate tcl entirely from a FAT partition, for example, you are forced to use the backup system. The ''/tce'' and all its contents do not require file permission information, so can be stored on a FAT partition if required. |
Some more advanced settings are stored in the linux file system, and these cases have to be individually entered into the ''.filetool.lst'' to have them restored at the next boot. One such example is when you use the Xorg extension for improved graphics performance - its configuration file is ''/etc/X11/xorg.conf'', so to have any Xorg graphics settings permanent, you have to add ''etc/X11/xorg.conf'' to ''/opt/.filetool.lst''. (//Note the lack of leading forward slash!//) tcl will unpack all extensions and afterwards, will add any files you specified in this way to the linux file system. | Some more advanced settings are stored in the linux file system, and these cases have to be individually entered into the ''.filetool.lst'' to have them restored at the next boot. One such example is when you use the Xorg extension for improved graphics performance - its configuration file is ''/etc/X11/xorg.conf'', so to have any Xorg graphics settings permanent, you have to add ''etc/X11/xorg.conf'' to ''/opt/.filetool.lst''. (//Note the lack of leading forward slash!//) tcl will unpack all extensions and afterwards, will add any files you specified in this way to the linux file system. |
| |
=====Choosing a different background===== | =====Choosing a different Wallpaper/Desktop background===== |
| |
If you want to have a nice pic on your desktop instead of the default tinycore one, download it and save it in /opt/backgrounds. Then with the Wallpaper chooser (//look in Control Panel//), select if from the list. | |
| |
If you are not using a permanent /opt as explained above, add opt/backgrounds to .filetool.lst. That's all - if persistence is already up and running for you, the wallpaper will be there next time. | |
| |
Bear in mind that images are often very large files, and keeping many image files in /opt/backgrounds will blow out the backup time unnecessarily. Since these are static files, you can also place your image file in /tce and create a symlink to it in opt/backgrounds. | |
| |
| See [[wiki:wallpaper_desktop_background|Setting Up - Wallpaper]]. |
=====Executive summary===== | =====Executive summary===== |
| |
* To make everything persistent, use the Set button in Appbrowser to set a location for /tce. If using the built-in installer, this is taken care of. | * To make everything persistent, use the Set button in Appbrowser to set a location for /tce. If using the built-in installer, this is taken care of. |
| |
* To create permanent ''~HOME'' and ''/opt'' directories and reduce backup and restore times, use the boot option "''home=xxx''" and optionally, "''opt=xxx''" where "xxx" are any valid linux partitions. Manually edit ''/opt/.filetool.lst'' to remove the home entry and most ''/opt'' entries. | * To create permanent ''/home'' and ''/opt'' directories and reduce backup and restore times, use the boot option "''home=xxx''" and optionally, "''opt=xxx''" where "xxx" are any valid linux partitions. Manually edit ''/opt/.filetool.lst'' to remove the home entry and most ''/opt'' entries. |
| |
======Advanced Topics====== | ======Advanced Topics====== |
When you specify the ''/tce'' directory's location as a boot option, you can place it anywhere you like on your PC - another partition, another hard disk altogether, even a usb stick that you plug in for the session, or inside another directory. | When you specify the ''/tce'' directory's location as a boot option, you can place it anywhere you like on your PC - another partition, another hard disk altogether, even a usb stick that you plug in for the session, or inside another directory. |
| |
//**Note: If you decide to use a USB device, you have to use a boot code of ''waitusb=5'' to tell tcl to wait 5s, or longer if required, for the usb file system to be mounted, or it will not find ''/tce'' and you will be running in cloud mode instead.**// | **//Note: If you decide to use a USB device, you have to use a boot code of// ''waitusb=5'' //to tell tcl to wait 5s, or longer if required, for the usb file system to be mounted, or it will not find ''/tce'' and you will be running in cloud mode instead.//** |
| |
Because you can place a given boot case's /tce in any location, you can have more than one ''/tce'' location for different purposes, and set up a multi-boot scenario where you can choose which /tce to use for a particular session. | Because you can place a given boot case's /tce in any location, you can have more than one ''/tce'' location for different purposes, and set up a multi-boot scenario where you can choose which /tce to use for a particular session. |
For extensions which are very seldomly used, you can use the "''Download + load''" setting in AppBrowser which will download and load the app, but will not include it in either of the OnBoot or OnDemand lists. You can also load these ones later again by using the "''Local''" button in AppBrowser, which then looks in ''/tce'' for all your downloaded extensions. | For extensions which are very seldomly used, you can use the "''Download + load''" setting in AppBrowser which will download and load the app, but will not include it in either of the OnBoot or OnDemand lists. You can also load these ones later again by using the "''Local''" button in AppBrowser, which then looks in ''/tce'' for all your downloaded extensions. |
| |
You can play around with which extensions to load where in the AppsAudit utility. If you are unsure if a particular app is essential or not, just put it in ''OnBoot'' - you can change later. (//The ''OnBoot'' and ''OnDemand'' lists are also to be found in ''/tce''. They are maintained by AppsAudit.//) | You can play around with which extensions to load where in the AppsAudit utility. If you are unsure if a particular app is essential or not, just put it in ''OnBoot'' - you can change later. (//The ''OnBoot'' and ''OnDemand'' lists are also to be found in ''/tce''. They are maintained by AppsAudit.//) |
| |
| If you are running text mode only, and want to change an extension to ondemand, remove it from onboot.lst then run "ondemand appname". This will add a script to the ondemand directory (in your path) that will mount the tcz when you need them. To change it back to onboot, add it back to onboot.lst |