General Support - load persistent overlay to ram

barryzoot - 14.12.2012, 23:01 Uhr
Titel: load persistent overlay to ram
Hi there,

I need a debian usb environment for running scientific experiments on pc's which have at least 4gb of ram. I fiddled around with debian wheezy live, knoppix and kanotix. Kanotix seems most promising at the moment.

I am looking for some help to change the configuration a bit to achieve the following:

The setup needs to be a persistent kanotix system which is loaded from usb flash and runs entirely in ram. (I think puppy linux still works this way, not sure)

The specs:

- standard sys + overlay is entirely loaded into the ram
- changes are made in ram
- at shutdown changes are saved to live-rw (image or partition)
- launcher on the desktop to save provisional changes / snapshots. By this I mean the option to manually save the provisional changes to usb live-rw without shutting down
- a linked folder in the home directory pointing to a place on the live-rw where files can be placed directly on the live-rw

Additionally it would be nice but not essential to have the option to merge the standard sys and the overlay (with or without /home)

Anybody an idea how to achieve this configuration?
Kano - 14.12.2012, 23:23 Uhr
Titel: load persistent overlay to ram
You might want to try a snapshot:

sudo apt-get update;sudo apt-get install squashfs-tools;sudo live-snapshot -t squashfs

when this is put inside the live folder then your changes are available next time.
barryzoot - 14.12.2012, 23:29 Uhr
Do you mean I have to boot without persistence and run sudo live-snapshot -t squashfs before shutting down?
barryzoot - 14.12.2012, 23:30 Uhr
I was thinking about two scripts and a mount cmd:

two scripts:

- rsync/cp live-rw from usb to persistence folder in sys (tmpfs)

- rsync persistence folder in sys to live-rw on usb


at boot (through boot parameter):
- mount tmpfs on the persistence folder
- run liverw-toram.sh

at shutdown:
- show: do you want to save changes to usb
- run liverw-tousb.sh

manual sync:
- show: do you want to save changes to usb
- run liverw-tousb.sh
barryzoot - 15.12.2012, 12:27 Uhr
Hi Kano,

I formatted my usb flash and put a fresh hellfire on it.
After boot I ran your commands, then created an ext2 partition from the remaining space on the flash with the label 'live-sn' and put the squashfs file (without the snapshot folder) in the root of this partition. Then rebooted into kanotix with manually inserting 'persitent' in grub.
On shutdown I get an error it cannot sync (or create) the snapshot because the fs is readonly. It seems it wants to put the file on the read only live partition instead of the live-sn partition. Any suggestions?

I read some documentation on overlay and snapshot. I could not find an explanation what the difference is. Do you know if overlay means always direct writing on media and a snapshot writing in ram?

Thanks for your help.
barryzoot - 15.12.2012, 14:20 Uhr
I found something about snapshots in manual-1.x from debian live (http://live.debian.net/manual-1.x/live-manual.txt) but not in the manual from debian wheezy live. The old manual states that snapshot do not support file deletion at that moment. Do you happen to know if snapshots are still supported in wheezy? And if yes does it already support file deletion? And is there any documentation available? I will try to contact the debian live developers as well.
barryzoot - 15.12.2012, 15:07 Uhr
actually most elegant for me would be (and maybe easier):

- one partition on the usb stick, one file for the root and home
- at boot load the file to ram
- work in ram
- at shutdown or manual invoke, save/merge changes to the file
gs - 15.12.2012, 20:16 Uhr
I have been following this for a while and still do not understand the problem.
I am running Hellfire with persistence, having added "persistent" to the boot-menu and having two partitions on the usb-stick, one with the kanotix-files and the other with the label "live-rw".
Any alterations/additions to the live-system can be found in the live-rw-partition. If, for instance, I generate new files in the live-home, they can be seen in the home of live-rw, since this is the place where alterations are stored.
When, in addition, I generate a duplicate boot-menu without the "persistent" entry, I can boot the original Hellfire - my alterations in the persistent mode are then not added upon booting.
So I have, before booting Hellfire-live, always the choice between running my adapted Hellfire or the original one.....
barryzoot - 16.12.2012, 00:25 Uhr
The problem with the default persistent option is that only the original image is loaded into ram and the added packages and configs not. They are directly written and read from the usb flash partition.
gs - 16.12.2012, 07:51 Uhr
and what is the problem with this, or, in other words, what is the advantage to have the added packages and configs in RAM instead of the flash partition?
barryzoot - 16.12.2012, 11:19 Uhr
The system is much faster when using.
I need a responsive fast system, booting may take a little longer.

See the manual 1.x from debian-live may 2010 in paragraph 7.5.3:

Snapshots are collections of files and directories which are not mounted while running but which are copied from a persistent device to the system (tmpfs) at boot and which are resynced at reboot/shut-down of the system. The content of a snapshot could reside on a partition or an image file (like theabove mentioned types) labeled live-sn, but it defaults to a simple cpio archive named live-sn.cpio.gz.
As above, at boot time, the block devices connected to the system are traversed to see if a partition or a file named like that could be found. A power interruption during runtime could lead to data loss, hence a tool invoked live-snapshot --refresh could be called to sync important changes. This type of persistence, since it does not write continuously to the persistent media, is the most flash-based device friendly and the fastest of all the persistence systems.
gs - 16.12.2012, 12:51 Uhr
so I see. Good luck!
barryzoot - 17.12.2012, 02:18 Uhr
Snapshot for live-sn works at the moment. Could you tell me how i can add home-sn as well (on the same partition as live-sn)? It seems that live-sn does not include /home.
When I boot with the option 'toram' does it also load the live and home snapshot into ram?
barryzoot - 17.12.2012, 09:57 Uhr
I made live-sn with sudo live-snapshot -t squashfs.
Then i made home-sn with sudo live-snapshot -t squashfs -c /home
And as test i did a sudo live-snapshot -f to sync the images.
After i updated the sys with synaptic the live-snapshot cmd could not be called, i had to use /sbin/live-snapshot.

I get errors on boot:

cp cannot stat etc

I can get into the system but / is a mess. All folders are multiplied.

I have something like this /home, /home1-1, /home1-2,home2-1, /var, /var1-1, /var2-1.

Any suggestion?
Just thinking i did not delete the snapshots in /live, maybe i now have snapshots in snapshots?
gs - 17.12.2012, 10:26 Uhr
maybe look for kano in IRC
Alle Zeiten sind GMT + 1 Stunde
PNphpBB2 © 2003-2007