WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Alternative to filetool.sh for simpler/automatic persistence  (Read 4023 times)

Offline aw

  • Newbie
  • *
  • Posts: 45
Alternative to filetool.sh for simpler/automatic persistence
« on: November 11, 2016, 01:30:31 AM »
Hi,

One of the problems I've encountered often with filetool.sh is the need to run a backup every time a file is modified. This is a pain for files such as /etc/shadow, or log files in /var/log/.

I've created an alternative called symlinktool.sh which copies the files to a persistent disk, and then creates symlinks to those files in place of the originals. On boot, rather than overwriting the files in memory from mydata.tgz, it replaces them with symlinks to the original files on persistent disk.

Example:

Code: [Select]
ls -lah /etc/shadow
lrwxrwxrwx 1 root root 37 Nov 11 08:30 /etc/shadow -> /mnt/sda1/mydata/etc/shadow

You can find the script and more detailed explanation here: https://github.com/aw/tinycore-symlinktool (MIT license)

Of course, it requires your disk to always be mounted (bad for piCore), but this means you're now free to modify files and they will automatically be saved to persistent disk, meanwhile maintaining the awesomeness of TinyCore Linux's architecture.

Just a note: Yes I did consider doing this with symlinks stored in /home/tc/, and then adding /home/tc to filetool.lst.. the problem is I don't want system files and other "root only" sensitive files to be in /home/tc.

This solution stores the files in /mnt/sda1/mydata (assuming restore=sda1 mydata=mydata).

Let me know what you think.

Cheers!
github.com/aw

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Alternative to filetool.sh for simpler/automatic persistence
« Reply #1 on: November 11, 2016, 08:48:27 AM »
In my backup I have sym-links to big files & folders stored elsewhere, too (Downloads, Dropbox, WINE).
Mainly to prevent  mydata.tgz  from getting too big.
Also to always keep certain files changes (f.e. logs) in case it's not desired to backup anything else (or I forget to backup).
Plus I'm using sym-links to certain files & folders across several installations of Core.

Doing this for some time now, I prefer to move files and create sym-links manually. Apart from the need (in most cases) to take care of Linux file permissions on the file system the sym-links point to, I can't tell of any issues so far.
Download a copy and keep it handy: Core book ;)

Offline aw

  • Newbie
  • *
  • Posts: 45
Re: Alternative to filetool.sh for simpler/automatic persistence
« Reply #2 on: November 11, 2016, 06:21:02 PM »
Yes that's a good approach as well.

This symlinktool.sh handles it automatically on boot.

I've added a patch to tc-restore.sh which enables a new boot code: symlinksrestore to make it an optional feature:

https://github.com/aw/tinycore-symlinktool/blob/master/tc-restore.sh.patch
github.com/aw