wiki:Baton_-_Change_files

Baton is our little Mini-ITX-Computer which was originally intended to use for the laboratory Das Eingebettete Orchester. It only has a 1GB flash disk for its OS and programs. To protect the flash disk from crashing, we made it read-only. Therefore, Baton uses a unionfs for the root file system, making it writable, but like in Knoppix all changes are only made to the RAM.

This Howto describes how to change files permanently on the read-only system. If you want to install or remove packages, please read Baton - Install new packages .

Make the rootfs writable

On system startup the flash disk is already mounted twice. One mount is located at /mnt/root-rw and one is the root (/) together with the unionfs itself. Due to the unionfs the root seems to be writable, but all changes you make are only applied to the RAM, so on a reboot all changes will be lost.

In /mnt/root-rw you can see the system as it is on the flash disk. Changes are not possible to be made here so far, because this is mounted read-only by default for security reasons. But there is a simple script which makes this directory writable and consequently makes it possible to write on the flash disk. You need to be root for this:

baton:~# ~/makewritable The root filesystem is now writable in /mnt/root-rw/. baton:~#

Note: Everything you change in this directory will immediately be applied to the real root, too!

Fix files from RAM to flash disk

To fix any files from the RAM to the flash disk now simply locate them in your filesystem and copy it to the corresponding location in /mnt/root-rw:

baton:~# cp -a /path/to/file /mnt/root-rw/path/to/file

Note: The -a option is optional and copies a file recursively (for directories) without changing file permissions or following a link.

Note: If the filesystem is writable, users can also do changes according to their file permissions, e.g. they can write in their home directories.

Make the rootfs read-only again

Please make sure that you remount the filesystem read-only again after applying any changes. Otherwise the ability to write could be abused.

baton:~# ~/makereadonly The root filesystem is now read-only in /mnt/root-rw/ again. baton:~#

--Lwi ? 23:32, 10 November 2006 (CET)