Saturday, June 26, 2010

Tips for using solid state drives on Linux.

This website runs a web server with a 4GB CF card in a very very small computer. I was trying to come up with ways to reduce writes on this device and I remembered UnionFS. UnionFS can take 1 folder and make it read-only and have all the changes written to another folder. To the user, everything will look the same. This is very good when adding a disk to a computer and your not using LVM.

What I want to do? I want /tmp, /var/log, /var/home, and /root to have the changes written to my USB device that is mounted as /mnt. These directories receive a lot of writes to them.

I copied the following commands to /etc/rc.local so that they are executed when the machine boots:

—————–

mount -t unionfs -o dirs=/mnt/logs=rw:/var/log=ro unionfs /var/log
mount -t unionfs -o dirs=/mnt/filesystem/root=rw:/root=ro unionfs /root
mount -t unionfs -o dirs=/mnt/filesystem/home=rw:/home=ro unionfs /home
mount -t unionfs -o dirs=/mnt/filesystem/tmp=rw:/tmp=ro unionfs /tmp

—————–

Lets make sure everything worked by doing `df -h`:

—————–

/dev/sda1 3.8G 1.6G 2.1G 44% /
unionfs 7.5G 3.3G 3.8G 47% /var/log
unionfs 7.5G 3.3G 3.8G 47% /root
unionfs 7.5G 3.3G 3.8G 47% /home
unionfs 7.5G 3.3G 3.8G 47% /tmp
-----------------
If you want this to be mounted at boot time without
using /etc/rc.local, simply add the following to /etc/fstab:
-----------------
unionfs /tmp unionfs dirs=/mnt/filesystem/tmp=rw:/tmp=ro 0 0
unionfs /home unionfs dirs=/mnt/filesystem/home=rw:/tmp=ro 0 0
unionfs /var/log unionfs dirs=/mnt/logs=rw:/var/log=ro 0 0
unionfs /root unionfs dirs=/mnt/filesystem/root=rw:/tmp=ro 0 0
-----------------
Now all the changes will be written to my USB device and my main CF
cards will not be written to a lot.

Fedora upgrade woes and solution.

I tried many times to upgrade from Fedora 12 to Fedora 13 with too much fail! I decided to do a fresh install of Fedora 13 in VirtualBox and generate a package list from my Fedora 12 box so I can make it exactly the same.

Instructions:

1. On my Fedora 12 box:
rpm -qa | cut -d – -f 1 > packages.txt

2. Install Fedora 13

3. Copy packages.txt from Fedora 12 to Fedora 13.

4. Copy .repo files in /etc/yum.repos.d from Fedora 12 to Fedora 13.

5. yum install -y –skip-broken `cat packages.txt`

6. Done. =)

How I deal with log files on my SSD Web Server

My backup web server has a 8GB CF card. I want to reduce the number of writes to it as much as possible to save money and keep my server healthy. I added the following to my /etc/rc.local so that the logs files are created in RAM every time the server boots.

How it works:

1. Create the ram disk directory.
2. Mount the ram file system.
3. Erase old logs.
4. Use touch to create an empty log file in the ram disk directory.
5. Link the log file in the ram disk directory to /var/log

[ /etc/rc.local ]
#Creates a tmpfs RAM disk and mount it
mkdir /ramfs;mount -t tmpfs /dev/ram0 /ramfs;mkdir /ramfs/httpd
LOG[0]=messages
LOG[1]=secure
LOG[2]=maillog
LOG[3]=yum.log
LOG[4]=rpmpkgs
LOG[5]=dmesg
LOG[6]=boot.log
LOG[7]=spooler
LOG[8]=scrollkeeper.log
LOG[9]=cron
LOG[10]=Xorg.0.log
LOG[11]=acpid
LOG[12]=btmp
LOG[13]=wtmp

LOG[14]=httpd/access_log

LOG[15]=httpd/error_log

for ((c=0;c<=15;c++))
do
rm -f /var/log/${LOG[c]};touch /ramfs/${LOG[c]};ln -s /ramfs/${LOG[c]} /var/log/${LOG[c]}
done

Mephisto Backup v1.11 released

The best release ever of Mephisto is now available. If any bugs are found, please report them to phillip.tribble@gmail.com.
Features:

Partitioner

Raid configuration utility

Bug fixes

Code improvements.

More stable user interface with less exiting

Complete list of changes:

http://code.google.com/p/mephistobackup/source/browse/releases/mephisto111/mephisto/mephisto/Main.java

Gui in development for Mephisto v1.12



I spend most of my weekend working on the GUI for Mephisto v1.12. This will be the first official release with a GUI. Other things to look forward to is a few bug fixes and improvement. The GUI in v1.12 will basically be an interactive terminal window with buttons and message boxes for input. The goal for v1.13~v1.14 will be completely non-text. The default restore disc is a modified version of the Gentoo minimal installation disc and does not contain a graphical environment. I am not sure if I want to host another type of restore disc because I already maintain two (one for 32bit and 64bit) and that is a lot of work and bandwidth to offer. Supporting a GUI live CD will result in maintaining 4 CD’s for each release. In short, Mephisto v.1.11 and v1.12 have an option to create a custom restore disc. People wanting the graphical version of Mephisto can create a custom disc with any bootable Linux distro. What do you think of the GUI?

Try it out!

(Please place feedback as a comment to this post)

tar xf mephisto-1.12.tar.gz

cd mephisto-1.12

./mephistobackupgui