Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: malloc69 on February 16, 2011, 04:31:14 AM

Title: All in RAM except DB (is it possible?)
Post by: malloc69 on February 16, 2011, 04:31:14 AM
I've a tinycore 3.4.1 running with extensions en PPR mode. I'm using postgres and the database can grow quite large, so I do not care to keep the database in the file mydata.tgz (take much to shut down the system). It is also essential to turn off the computer, unplugging it directly from the outlet (better not ask).

What way could load the system and the extensions in RAM (PPR) and leave only the files of the database on disk (PPI).

with this what I try is to prevent the system is corrupted when i turn it off, keeping the database as safe as possible.

thanks
Title: Re: All in RAM except DB (is it possible?)
Post by: Juanito on February 16, 2011, 06:02:17 AM
I've never used postgres, but doesn't it give you the option to choose where to store the database? If so, you can specify somewhere on permanent storage.

If postgres does not allow you to choose where to store the database, you could use a symlink to direct it to somewhere on permanent storage and just enter the symlink in filetool.lst
Title: Re: All in RAM except DB (is it possible?)
Post by: Arslan S. on February 16, 2011, 08:56:12 AM
from postgres --help
Code: [Select]
-D DATADIR      database directoryso example usage
Code: [Select]
postgres -D /mnt/hda1/db_data
Title: Re: All in RAM except DB (is it possible?)
Post by: malloc69 on February 16, 2011, 09:17:10 AM
thank you both. your answers are helpful to me.
Title: Re: All in RAM except DB (is it possible?)
Post by: malloc69 on February 18, 2011, 05:29:21 AM
I take this post, to indicate how PostgreSQL should be started at boot the system (and maybe save someone some time).

Add the following line in the file '/opt/bootlocal.sh':

Code: [Select]
su tc -c 'postgres -D path_to_data_dir &'
Title: Re: All in RAM except DB (is it possible?)
Post by: Arslan S. on February 18, 2011, 02:22:25 PM
Code: [Select]
start-stop-daemon --verbose --oknodo --background --chuid "tc:staff" --start --exec "/usr/local/bin/postgres" -- "-D /path/to/datadir"
i will add an init.d script next update