Sunday, August 12, 2012

Linux SSD optimalization

Since the SSD prices are dropping and it's still summer vacation so I have a more spare time than usual, I decided to upgrade one of my servers with an SSD. Since the server I upgraded is very multifunctional it could benefit a lot from optimization, it functions mainly as NAS (CrashPlan for Windows, Time Machine for OS X) but is also used as Home Theatre PC (XBMC).

Luckily there are a lot of resources about optimizing your SSD in Linux.

Very helpful resources were:

I ended up doing the following:

  • Partitioning the hard disk with gdisk, which helps me align the partitions
  • Use Logical Volume Management (lvm) 
    • Using the --dataalignment option (see also link) for the physical volume
    • Creating an ext4 partition on the logical volume with adjusted block size and stripe/stride-parameters
  • Mounting the ext4 partition with noatime and discard options
  • Using noop scheduler for the ssd's only (see script below)
  • Mounting /var/tmp and /var/log in ramdisk
  • Enable writeback (see script below)
  • Make the "swappiness" as low as possible
  • Use ionice to give XBMC priority over netatalk/crashplan when watching movies
    This is not because of the SSD, but I moved one of my RAID-0 harddisks from S-ATA600 to S-ATA300 because I expect the SSD will use the higher throughput better but apparently this caused problems (stuttering in movies) when a computer was backing up and watching a movie at the same time..
To set the scheduler and writeback to the right disks I modified the rc.local-script I found on the ArchLinux wiki:

declare -ar SSDS=(

for SSD in "${SSDS[@]}" ; do

  if [[ -e $BY_ID ]] ; then
    DEV_NAME=`ls -l $BY_ID | awk '{ print $NF }' | sed -e 's/[/\.]//g'`

    if [[ -w $SCHED ]] ; then
      echo noop > $SCHED
   hdparm -W1 /dev/$DEV_NAME

I also used this opportunity to switch to UEFI and LVM. Especially the UEFI took a whole lot more than I expected. I will write an article about that later.

Friday, August 10, 2012

LCDproc on Mac OS X

I had the opportunity to order some small LCD's (HD44780) at a very fair price, since I already got one in my backup-server i tried to get it working on my docked MacBook running Mac OS X (10.8). Took some time, but in the end I got it working with not too much effort.

Steps I took were:

  1. Download LCDproc source from the official website
  2. Install libusb from homebrew (brew install libusb)
  3. Install libftdi from homebrew (brew install libftdi) <-- this was needed because I used a FT245RL brekout board to connect it.
  4. Configure with "./configure --prefix=/usr/local/ --enable-drivers=all --includedir=/usr/local/include/ --enable-libftdi=yes"
  5. make -j6
  6. sudo make install
Then changed /usr/local/etc/LCDd.conf like this: (only changed/added values shown).




Of course, you need to have the XCode Command Line tools installed. Also I had the FTDI D2XX driver already installed, the VCP drivers will most likely conflict with libftdi.

I also got it showing my Growl notifications thanks to