See this thread for more background information: viewtopic.php?f=51&t=113&p=443&hilit=fi ... magic#p443
The short explanation is that magic folders will allow you to save changes that you make to a particular folder in your live filesystem to a particular folder (or .dat image file) on a hard disk, USB flash drive, or other media.
For example, if you do not want all of your persistent changes saved to the same place (e.g. save.dat), you can save save your changes to /root to root.dat and changes to /guest to guest.dat. Or, you can create a file on your flash drive that will save files to the same location across multiple users or installs (more on that later).
To begin using magic folders, you need to run the script from the command line. Open a console, and enter 'magic_folders'. The script will tell you about magic folders, and then prompt you for a folder in your live filesystem. For example, /home/guest/Downloads.
It will then prompt you for a location on a real device, where the changes will be saved. For example, /mnt/sdb1/Downloadsave.dat. If this file (or in this example, container) does not exist, the script will create one for you, at the size of your choosing. If you are saving changes to a FAT or NTFS filesystem, it is suggested that you use a .dat file container to avoid file corruption.
Once you've selected (or created) your destination, the script creates a configuration file in your rootcopy directory, at /porteus/rootcopy/etc/magic_folders/folders.cfg. This file is a list of paired folders, and you can edit it directly (or use the script again) to create more magic folders.
Upon reboot, your system will pair the folders, and changes in one location will show up in the other. Using my example above, any time I save something to my /home/guest/Downloads directory, it will also be saved to the Downloadsave.dat container on my flash drive, at /mnt/sdb1.
*NOTE* Changes saved to magic folders will survive reboot, even in 'Always Fresh' mode. Thus, I suggest we should have a new cheatcode, 'nomagic', so that someone can boot into 'Always Fresh' mode in the event something in a magic folder is corrupted or causes bootup failure.
Now, for a real example of one implementation I've come up with for myself:
I want a folder on my desktop, where I can save and access files directly, without navigating through a bunch of subdirectories. I want this to be accessible for both my 'root' and 'guest' users.
I created the following directories in my /porteus/rootcopy file:
This puts a folder on my desktop, within my live filesystem.
I then created a directory at the root of my flash drive and called it 'magic' as well:
I then ran the magic_folders script, specifying /home/guest/Desktop/magic as my source location, and /mnt/sdb1/magic as my destination. This created the text file in /rootcopy/etc/magic_folders/folders.cfg, which I then edited to include the second linked file for my /root/Desktop folder. This is my folders.cfg file:
Upon reboot, the folders get linked together. If I log in as guest and put something in my 'magic' folder on the desktop, I can reboot as root, and access the same file that I put there earlier (as 'guest') by clicking on the 'magic' folder on root's desktop. I can also access this file from windows, by navigating to E:\magic. Note that I do not have 3 copies of these files on my flash drive. These files are only stored permanently on my pendrive, at /mnt/live/sdb1/magic, and are synced from there into the live filesystem at startup.
Code: Select all
/mnt/sdb1/magic /home/guest/Desktop/magic /mnt/sdb1/magic /root/Desktop/magic
(yes, I know that I am not following my own advice to store my files to a .dat container when using a FAT filesystem. In this case, I am only storing documents and not system configuration files.)
This begins to demonstrate the flexibility of the magic folders system--I'd love for anyone else to post examples of how they are using them.
Thanks, and enjoy!
One final note: If you are using a flash drive and it is not mounted automatically at /mnt/sdXN at startup, try using the cheatcode 'delay=2' at boot time. This worked for me.