Monday, February 22, 2010

performance tips for OpenSuSE on a USB flash drive

I recently built a third desktop, since my laptop was a bit too slow to play HD x264 movies. I didn't want to buy a case, so I simply mounted the motherboard, power supply, etc. on a shelf. Unfortunately, without a case, my old 60GB hard drive was quite noisy, so I bought a 8GB USB drive for $24 from newegg. If you have the money, I highly recommend getting a real SSD instead, since those have hardware caches. That being said, the system is usable once it has been tweaked properly. The essential steps are:

  • Set max_sectors to 1024. The write performance is still a pretty horrible 5MB/sec (I have a patriot xporter), but it's much more livable with common software (web browsers, etc.). I added the following to /etc/init.d/boot.local,
    echo 1024 > /sys/block/sda/device/max_sectors
  • Mount the drive with write barriers disabled. This is essential, as unlike normal hard drives, USB mass storage devices don't have caches. My fstab options for the device eventually looked like this (for ext4),
    noatime,data=writeback,acl,user_xattr,barrier=0,nobarrier
  • You can try the following for good luck, though I doubt it's nearly as relevant as the above,
    tune2fs -o journal_data_writeback /dev/sda1
    tune2fs -O dir_index /dev/sda1
cheers! If you have additional suggestions, please post them here or email me (ntung at ntung).

Sunday, February 7, 2010

Writethrough disks on VirtualBox

I like VM snapshots very much, but there's times when you don't want to revert your hard drive -- to avoid losing documents, wasting storage space, etc. To add a new hard drive that doesn't snapshot, "release" it in the media manager (ctrl+d from the main VirtualBox GUI), and then run the following command line:

VBoxManage openmedium disk --type writethrough

Tuesday, December 1, 2009

link: xset dpms off

from here [1], you can make sure your screen saver turns your monitor(s) off.

#!/bin/bash
qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock
xset dpms force off
sleep 3
xset dpms force off

Thursday, November 19, 2009

save a mms stream to a file with vlc command line

Here's a quick one-liner for how to save a mms stream to a file with VLC. I found most of it through Google codesearch.

cvlc -vvv << mms:// url >> --sout \
"#transcode{acodec=vorbis,ab=96}:duplicate{dst=std{access=file,mux=ogg,dst=out.ogg}}" 

However, VLC won't encode variable bitrate ogg, and the current version hangs after it's done. I wrote a simple python script to hack around this (click read more...)

Saturday, November 14, 2009

link: fontsquirrel.com

This site is great for web development -- it provides a "@font-face kit" link for each font, which has fonts converted to all formats -- woff (web open font format), eot (Internet Explorer), otf, and svg!

Friday, November 13, 2009

link: opensuse 11.2 released

opensuse 11.2 was released yesterday: http://software.opensuse.org/112/en

I installed it on my laptop promptly. The installer was a little rough -- I unchecked "use automatic configuration" and disabled the images installation -- and then it worked. These performance workarounds for rpm should probably be implemented more at the file system level. In any case, it's nice to have a stable distro with the 2.6.31 kernel (it does boot 5-10 seconds faster), and the Intel UXA driver.

Wednesday, October 28, 2009

more hacking: working around zsh autocomplete for yast2

I found that zsh under opensuse doesn't complete yast2 correctly. I'm not totally sure why this works and the previous version doesn't (for example, why couldn't I execute /sbin/yast2 from the autocompleter?). In any case, in /usr/share/zsh/4.3.10/functions, delete "_yast" and replace "_yast2" with the following,