Articles

[HOWTO] Create a save.dat container, and why you need one

This information is also available as Appendix B of the Official Installation Guide, here.

Porteus allows users to save their changes (i.e., system settings, downloaded files, bookmarks, browser history, etc) to a folder or image file (aka container) that exists outside of Porteus' core files. The 'changes=' cheatcode parameter sets the location for these changes. When you start Porteus with this cheatcode (enabled by default for USB installations), it will boot up the operating system and then apply your changes from this location. By default, Porteus is set to save these changes to /porteus/changes.

If you are installing Porteus to a device that is formatted with a Windows filesystem (e.g. FAT 32, NTFS, etc), you are required to use a '.dat' container for your changes. This container allows you to retain linux permissions and symlinks, which are necessary for your system to run properly and securely. 

While starting up, Porteus will run a check to see if you are asking it to save changes directly to a device with a Windows filesystem.  If you are, then Porteus will boot without saved changes enabled.  To create a '.dat' container file and start saving your changes, boot Porteus into KDE, LXDE or Xfce.  Then open up the menu and navigate to "System -> Porteus save.dat manager" (NOTE:  You can also access this program through "Porteus Settings Centre", which will help you to customize various settings, including creation of a save.dat).  Click on this application to open it, and click on the "Create" button.  It will ask you for the name, size and location where you want to create it .  You can choose any name you like, for example, porteussave, save, mychanges, etc (upon creation, the .dat suffix will be added).  You must then enter the size of the container in megabytes and a the location on disk (e.g. /mnt/sdb1/porteus/, if sdb1 is your desired storage device), then click 'OK' and it will be created and placed on your storage device.  In order to start saving your changes, you will need to make a simple modification to the file that configures your bootup procedure.   The save.dat manager will walk you through these changes, but just in case, here are the necessary steps to peform this manually:

As root, open the file /boot/syslinux/porteus.cfg. You will have several entries in this file, which look like this:

LABEL xconf
MENU LABEL Graphics mode (KDE).
KERNEL /boot/syslinux/vmlinuz
APPEND initrd=/boot/syslinux/initrd.xz changes=/porteus/
TEXT HELP
Run Porteus the best way we can.
Try to autoconfigure graphics
card and use the maximum
allowed resolution
ENDTEXT

LABEL lxde
MENU LABEL Graphics mode (LXDE).
KERNEL /boot/syslinux/vmlinuz
APPEND initrd=/boot/syslinux/initrd.xz changes=/porteus/
TEXT HELP
Run Porteus the same as above.
Lightweight LXDE to be
launched as default desktop
ENDTEXT


You will need to edit the end of the APPEND line, to make it read 'changes=/porteus/save.dat' (without the quotes, using the name you specified earlier). Save this file and upon reboot your changes will be saved to this container.

*NOTE* If you need to gain access directly to the files in your save.dat container (if, for example, you boot into 'Always Fresh' mode and need to remove or edit one of your saved files), you can mount the container on a loop, using these commands in a console:

mkdir /mnt/loop
mount -o loop /mnt/live/mnt/sdXN/save.dat /mnt/loop


where sdXN is the name of your device, e.g. sdb1.

You will then have access to these files, in /mnt/loop

Why isn't this process automated?

While it would be fairly simple to have Porteus automatically create a save.dat file container on the same drive as your Porteus install and update your porteus.cfg to point to it, doing so would keep our users from fully understanding the flexibility and the array of options that are available for storing their changes. Manually creating a .dat container allows you to fully customize the name, location and size of your container. Also, if you look at the documentation in /boot/docs/cheatcodes.txt, there are numerous options for implementing the 'changes=' cheatcode; you can point it to a folder or subfolder (on a linux filesystem) or a container file (on any filesystem), on any writeable device accessible by your system (or just point it to the root of the device, and it will create a 'changes' folder in the root of the device, provided it is has a linux filesystem), and you can reference the path by device name, device label, device UUID, or without referencing the device at all, to have Porteus search for the location on the same drive as your install. With these options, you can put your changes on a separate partition from your Porteus install if you want to, and you can have multiple installations of Porteus with their changes saved to different locations, and your data will be found and mounted, even if you use Porteus on machines with different hardware configurations. Container files can also be created for use with "magic folders", to save the contents of individual directories in your live filesystem to a container (or multiple containers). We believe that encouraging users to read, experiment, and learn will help them find a solution that works the best for their particular situation, as one size certainly does not fit all.