I needed to do a task that thrashes the filesystem a lot by creating many temporary files, then deleting them. Since all of this easily fits in a small ramdisk (I think these are 16 megabytes for my system, by default.)
So I figured, why not speed things up and reduce filesystem thrash with a ramdisk? I picked /dev/ram9
, but it doesn't really matter; I also put it in /tmp
so that it's not persistent (put it in /mnt
and make an addition to /etc/fstab
if you want it persistent.)
1234 | sudo mkfs -t ext3 /dev/ram9
mkdir /tmp/<name>
sudo mount /dev/ram9 /tmp/<name>/
sudo chown <user> /tmp/<name>/
|
That's it!
You might want to send out a mail from your server, which is running a (mostly) properly configured sendmail service, but it fails:
123 | $ mail -v -s "Test" name@host.com <<< 'Message Body'
name@host.com... Connecting to [127.0.0.1] via relay...
name@host.com... Deferred: Connection refused by [127.0.0.1]
|
Solution:
1 | sudo vi /etc/mail/sendmail.cf
|
Then go down to the line that looks like this
1 | O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
|
Add a new line, where Addr is your server's IP address (use
ifconfig
):
12 | O DaemonPortOptions=Port=smtp,Addr=xx.xx.xx.xx, Name=MTA
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
|
Then, depending on your distro, you'll do this or something similar:
1 | sudo service sendmail restart
|
And you're off and running.
Wanted to make a perl script that would generate a thumbnail sheet from a video. It seems that there are all sorts of tools out there that embed their own garbage onto the sheet - like watermarks - this doesn't.
Since this thrashes the filesystem, I
put it on a ramdisk first, and mounted it on
/tmp/thumbcreate
.
Code after the jump. It's a bit of a prototype stage, but it's quite mature. Perl script: