Results 1 to 2 of 2
I'm trying to mount /var, /tmp and /home into RAM at startup, and then copying their contents to a backup folder at shutdown. My fstab has lines like this:
Code:
...
- 01-17-2010 #1Just Joined!
- Join Date
- Feb 2007
- Location
- Winnipeg, MB
- Posts
- 14
Mount /var /home and /tmp into RAM
I'm trying to mount /var, /tmp and /home into RAM at startup, and then copying their contents to a backup folder at shutdown. My fstab has lines like this:
I made a script to copy their contents at startup and shutdown:Code:tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0 tmpfs /home/myrdos tmpfs defaults 0 0 tmpfs /var tmpfs defaults 0 0
My script is in /etc/init.d/start_bot.shCode:#! /bin/sh ### BEGIN INIT INFO # Provides: telebotram # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Telebot Ram Drive # Description: Load /home and /tmp into RAM ### END INIT INFO # Carry out specific functions when asked to by the system case "$1" in start) echo "Started start_bot.sh" echo "Copying /home/myrdos_backup to RAM..." rsync -a /home/myrdos_backup/ /home/myrdos echo "Copying /var_backup to RAM..." rsync -a /var_backup/ /var #read -n 1 -s ;; stop) echo "Stopping script start_bot.sh" echo "Saving home/myrdos to home/myrdos_backup" rsync -a --delete /home/myrdos/ /home/myrdos_backup echo "Saving var to var_backup" rsync -a --delete /var/ /var_backup read -n 1 -s ;; *) echo "Usage: /etc/init.d/start_bot.sh {start|stop}" exit 1 ;; esac exit 0
I run "sudo update-rc.d start_bot.sh defaults" to get it to run.
However, the script is not being run at shutdown, which is my main problem. Also, I would like to copy stuff to the /var directory before anything else runs to avoid unexpected behaviour, and shut it down just before the drives are unmounted. I'm not sure if this is happening.
Any help is appreciated!
- 01-18-2010 #2Just Joined!
- Join Date
- Feb 2007
- Location
- Winnipeg, MB
- Posts
- 14
Well, it looks like I've gotten a lot of views, but no one knows what the answer might be...
I wonder, does Linux automatically do wear-leveling on flash drives? If so, this might be unnecessary. The file system is fat32.


Reply With Quote
