Thread: ramdisk question
is there simple , safe way to:
-mount ramdisk @ boot
-copy on files folder on hard drive ramdisk
-execute shell script on ramdisk
upon shutdown recopy ramdisk hard drive
i run firefox ramdisk using these scripts:
tmpfs_firefox.sh:
----------------
#!/bin/bash
# created 31 jul 09
# change match correct profile--firefox's cache directory
profile="4n0pfp5v.default"
cd "${home}/.mozilla/firefox"
if test -z "$(mount | grep -f "${home}/.mozilla/firefox/${profile}" )"
then
mount "${home}/.mozilla/firefox/${profile}"
fi
if test -f "${profile}/.unpacked"
then
rsync -av --delete --exclude .unpacked ./"$profile"/ ./profile/
else
rsync -av ./profile/ ./"$profile"/
touch "${profile}/.unpacked"
fi
exit
--------------------
put in /etc/fstab:
# added 31 jul 09 improve firefox speed using ramdisk
firefox /home/tgalati4/.mozilla/firefox/4n0pfp5v.default tmpfs size=128m,noauto,user,exec,uid=1000,gid=1000 0 0
-----------
mounts directory called 4n0pfp5v.default (firefox's cache directory) temporary filesystem (ramdisk) of 128 mb.
-----------
run firefox using script call firefast located in /usr/local/bin
tgalati4@tpad-gloria7 ~/projects/scripts $ cat /usr/local/bin/firefast
#!/bin/bash
# created 31 jul 09 speed firefox
~/tmpfs_firefox.sh
firefox &
exit
----------------
check see if ramdisk exists:
tgalati4@tpad-gloria7 ~ $ df -h
filesystem size used avail use% mounted on
/dev/sda2 39g 25g 12g 69% /
tmpfs 944m 0 944m 0% /lib/init/rw
varrun 944m 388k 944m 1% /var/run
varlock 944m 0 944m 0% /var/lock
udev 944m 152k 944m 1% /dev
tmpfs 944m 2.5m 942m 1% /dev/shm
firefox 128m 74m 55m 58% /home/tgalati4/.mozilla/firefox/4n0pfp5v.default
----------------------
important part: using cron resync disk cache ramdisk every 10 minutes.
crontab -e
# m h dom mon dow command
*/10 * * * * $home/tmpfs_firefox.sh
although not want, has worked me on 2 years. can modify scripts similar.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [ubuntu] ramdisk question
Ubuntu
Comments
Post a Comment