Boot cheat code:
Persistent Storage allows you to install Slax, selectively save changes and optionally use swap space to boost performance, all without altering your partition table.
Persistent Storage provides an alternative method to save changes:
Instead of using 'changes=slaxsave.dat' to save everything, use 'persistent=slaxsave.sys' to selectively save files that you want.
Instead of being mounted to /mnt/live/memory/changes to hold every change possible, it is mounted to /export
When it is mounted, content from /root, /home, /usr/local and /opt will be automatically saved.
I.e., all users home files will be saved automatically, and they can optionally install anything to /usr/local or /opt without doing dir2lzm.
The Persistent Storage can also
be fully configurable. Where the Persistent Storage will be mounted, which directories will be automatically saved are fully configurable.
be able to use a swap file to boost performance.
pre-allocate some loop mount device so as to make it easier for you to loop mount devices manually.
|Caution, Persistent Storage is not something for the fainted hearts. I can understand why the save changes option is enable by default in Slax — because it is simple and good for dummies. If you want something better, you have to prepare yourself to embrace it first. I.e., if the following installation description doesn't make sense to you, then the Persistent Storage might not be for you, unless someone can come up with some nice GUI for dummies.|
Download persistent.lzm from http://sourceforge.net/project/showfiles.php?group_id=204283 and copy it into your modules directory.
Create persistent storage and swap file at the root of any partition.
Let's assume the partition is hdb3, and the files are system.dat & system.bin respectively as persistent storage and swap file. You can use any partitions or file names you like. This is only for illustration purpose. Then do the following:
cd /mnt/hdb3 dd if=/dev/zero of=system.dat bs=1024 count=64k mkfs.xfs system.dat
dd if=/dev/zero of=system.bin bs=1024 count=256k mkswap system.bin
This would produce a system.dat of 64M in size, and swap file of 256M. You might need much more than that, e.g., 512M persistent storage and 2G swap file. My swap file is 4G. The bigger it is, the bigger your virtual root fs will be.
Add an entry in your boot menu to boot into the persistent storage.
Best approach is to duplicate the save changes entry, and replace the "changes=…" with "persistent=system.dat swap_file=system.bin". Here is an example from my NimbleX grub boot menu. I'm leaving the save-changes "Boot in KDM" entry as the reference:
title NimbleX 2008 - Boot in KDM with persistent storage kernel /boot/vmlinuz-nx08 ramdisk_size=7120 root=/dev/ram0 rw vga=791 splash=silent quiet persistent=system.dat swap_file=system.bin autoexec=xconf;kdm initrd /boot/initrd-nx08.gz title NimbleX 2008 - Boot in KDM with save-changes kernel /boot/vmlinuz-nx08 ramdisk_size=7120 root=/dev/ram0 rw vga=791 splash=silent quiet changes=nimblex.data autoexec=xconf;kdm initrd /boot/initrd-nx08.gz
That's it, now reboot, the persistent storage and swap should be in place. To check, do
cat /proc/swaps mount
You should see system.bin in swap, and /home, /usr/local/ etc in mount. Here is an example:
$ cat /proc/swaps Filename Type Size Used Priority [...] /mnt/hdb3/system.bin file 16184 0 -2 $ mount [...] /export/root on /root type none (rw,bind) /export/home on /home type none (rw,bind) /export/usr/local on /usr/local type none (rw,bind) /export/opt on /opt type none (rw,bind)
I'm a constant visitor to the following forums,
Pick up the thread that I announce the release, and I'll answer there. You don't need an account to post to the Slax forum, BTW.
Or, you can post to the sourceforge.net help forum as well.
Detailed usage help follows.
Without Persistent Storage, you are required to create a Slax partition in order to run it from HD. Moreover, it is recommended to create a swap partition in order to get better performance.
Not any more! With Persistent Storage, there are no such barriers any more. You don't need extra free partition space in order to try Slax. You don't need to know how to shrink your existing partitions in order to create the above 2 partitions if you don't have the free partition space. The bottom line — with Persistent Storage, you don't need to risk your existing data in order to install Slax. Just copy Slax to your existing partition, and Persistent Storage allows you to run Slax, save your setting and utilize big swap space to boost performance without touching your partition table.
How to make it possible?
Copy Slax to your existing partition.
If you know how to make it bootable, then make it bootable, end of the story.
If your existing partition is Windoze ones and you don't know how to boot Slax from it, plug in your USB key and boot from there. Slax will automatically find the copy from your current HD partition and boot from there.
Nothing of your existing HD's critical section has been touched — MBR, partition table, boot sector, booting mechanism etc. I call it poor man's installation, or stealth installation if you like, because nobody else around you can boot the slax you put there except you — Your USB is the key.
Persistent Storage goes hand in hand with the frugal installation. I strongly recommend using frugal installation + Persistent Storage as the best practice for Slax. It gives you a reliable environment that you need, whether you are a newbie or an experience user.
For newbies, there is an old saying in Unix world that discourages inexperienced people from using the root account for daily unprivileged tasks — "He who plays in root will eventually kill the tree". I believe that, most of us who have played with *nix long enough, will have that moment "Ah! I wish I hadn't…".
With frugal installation + Persistent Storage, whatever disaster happens, even if you've accidentally removed the whole root tree, reboot and the nightmare is over. If you are using frugal installation + save changes, or unsupported full installation, a disaster means the end of you installation — reinstalling Slax again will save you much more time then trying to salvage the damaged system. That's OK for most people coming from the inferno world, in which reinstalling OS from time to time is the "best practice", however, quite a no-no in *nix world.
How could it be possible, "reboot and the nightmare is over"? Yes, it is not only possible but also "sure will" if you follow the following principles:
Do recommended frugal installation instead of unsupported full installation.
Do not use the default save changes, but Persistent Storage instead.
Install new modules using lzm modules, instead of 'slapget' into Persistent Storage.
In fact, avoid as much as possible to store any files under '\usr\local' or '\opt', even it is supported. Refer to the previous rule for alternatives.
Why stable is important even for experience users? It is vitally important if your system suddenly behaves strangely and you want to know why. When my system suddenly behaves strangely, the first thing that I would ask myself is, "what have I changed to my system?". For example, my home Debian system recently will freeze all of the sudden. It's total freeze, the system won't respond to warm reboot request, and even the hardware triggered power-down request. If I like some other Debian users who update their system every day, I would have to think hard when it started to behave like this and look hard into what packages have been upgraded around that time, and analyze their impacts one by one. Luckily, by keeping my system stable, I avoid all the above hassles, and I know that I need to look for the answers elsewhere. Another Slax example, right after I configured my hardware and saved all configurations in a lzm module and reboot, I experience weird network delays and package drops (extraordinarily heavy at times, shown by fast ping). On remembering the rumors that wolvix had some problems with it network module, I consequently reasoned that it was configuring my sound card that somehow triggered this bug. Only when such thing happened again with my stable and reliable frugal installation + lzm module approach did I realize the weird network problem was cause by something outside of my (Slax/Wolvix) system.
Slax is meant to be a live system. It should work wherever you plug your USB key to. However, the default Slax's save change setting defeats this purpose. I.e., once you've plugged in your USB key into one PC and all its hardware info is saved onto your USB, it is unlikely that this saved hardware profile work on any other PCs, except the ones that have exactly the same hardware configuration as the one you initially plugged into.
But you do need the save-change feature so that you don't need to e.g. customize your desktop, browser, etc each time you boot Slax. How to solve the dilemma that you need to save the changes yet make the change saved portable between any PC that you would possibly work on?
Persistent Storage is the answer. follow the following guidelines:
Copy Slax to your existing partition and boot with the aforementioned method. Booting from HD is much faster than booting from USB, and way way faster than booting off CD.
Remember to boot into the "always fresh" mode.
Do nothing but necessary system configurations (hostname, timezone, all of your hardware, etc) after boot.
Once you've done, remove all temporary files, including those from /tmp, etc, and save the changes as the lzm module.
dir2lzm /mnt/live/memory/changes /mnt/your_HD/slax/modules/111-hwconfig.lzm
This way the machine-dependent hardware configuration goes with the specific box, and your machine-independent USB key can boot any boxes into fully configured mode wherever you go.
If you need save info independently from machines, i.e., available to all machines but outside the default path supported by Persistent Storage, e.g., your time zone configuration, you can save them in /export, then create a lzm module that hold symlinks file to /export. Of course you can save them in independent lzm modules as well.
The other reason that I prefer Persistent Storage instead of the default save changes is that I'm a idealist. By doing above, I control what I save and how I save them. By using the default save changes, I have to carry all those garbage that I don't want with me.
Slax is only around 200M, and it should only take up 10% of you 2G USB right? NO! with the default save changes, your 2G USB key will be filled up with garbage within days.
With Persistent Storage, I know exactly what will end up in my persistent storage file because I put them there, and I know how big the file I need. I can mirror the persistent storage file onto my USB key, and never worry that it will grow out of control. Moreover, there will be over 1000 times less wear and tear to my USB key.
Don't know how to add another user in Slax but still want that each Slax user has their own preferences and histories saved? Persistent Storage can help, and it is much easier than fiddling with the unsupported workarounds.
Just create different persistent storage files for different users, and create different boot entries for them. This way, Jim and Joe can boot into their favorite setting without interfering with each other. I.e., they each have their own home directories to save whatever they want to save; and the system-wise tools and configuration files are shared across from lzm modules.