leif's blog

Clearing page caches in Linux

Brian France pointed this out to me, it's useful stuff, particularly when benchmarking I/O.

To free pagecache:

  • echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

  • echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

  • echo 3 > /proc/sys/vm/drop_caches

It's a good idea to sync first, to assure that all dirty page caches are dropped.

Ubuntu upgrades and BTRFS snapshots

One of my VMs is running Ubuntu with BTRFS on the boot disk. During an Ubuntu upgrade, I noticed a significant increase in disk space usage, and it turns out Ubuntu created a snapshot on my BTRFS volumes. Now, this is pretty neat, but once I verified everything was working fine, I wanted to delete the old snapshot. It turned out to be a bit more trickier than I though, but with some help from Sami Haahtinen, I got it to work. First, to list the sub volumes, I did

ubuntu-server (16:07) 3/0 $ sudo btrfs subvolume list /
ID 256 top level 5 path @
ID 257 top level 5 path @home
ID 258 top level 5 path @apt-snapshot-release-upgrade-oneiric-2011-10-13_12:41:44

The next step, which was crucial, is to "mount" the full disk BTRFS is using, without specifying a sub-volume:

ubuntu-server (16:09) 4/0 $ sudo mount /dev/mapper/ubuntu--server-slash /mnt

Your disk name will obviously differ (most likely), but after this, you can now delete this sub-volume:

ubuntu-server (16:09) 5/0 $ cd /mnt
ubuntu-server (16:10) 6/0 $ sudo btrfs subvolume delete '@apt-snapshot-release-upgrade-oneiric-2011-10-13_12:41:44'


Upgrading Ubuntu from command line

Ubuntu 11.10 was just released, and I eagerly decided to upgrade my "server' VM to "Oneiric Ocelot". My installation has no GUI, so I could not use the normal tools I'd use to do the live upgrade. So instead, I had to figure out the command line tools to use. Now, this is well documented, but is still worthwhile to repeat.

$ sudo apt-get install update-manager-core
$ do-release-upgrade -d

That's pretty much it, just follow the destructions on the screen (oh, and recommended not to do this over an ssh session).


Moab 2011: Day 4

Today we went through Chicken Corners:

P1000373 P1000371

Everything was mostly great, except when my extra fuel bladder (tank) dislodged and hooked up into the rear break. Not fun! We got a good 45 miles on the bikes in the morning, and I didn't even run out of fuel like last year. The EFI tuner must be helping. As usual, we decided to take a few shots goofing around as well:

P1000337 P1000363-EDIT

In the afternoon, we decided to do Slickrock, but only got a few miles on it, and then turned around. Everyone was tired, and Ted banged up his ankle again. Better save the energy, and ankles, for tomorrow. Only two videos uploaded today:



Moab 2011: Day 3

Finally a full days worth of riding, no broken bikes! Well, at least that's how it started... We went to 7 Mile Rim in the morning, getting a good ~18 miles in with a lot of fun riding. This is me to the left, on the Husqvarna, and Randy to the right on his Yamaha:

P1000291 P1000284

Randy's dad, Ted, of course had to be a showoff, and did a nice wipeout:


We moved on to Wipeout Hill, which Randy of course decided to run. This thing is really steep, and he almost had it... But not quite.

P1000311 P1000313

After lunch break, we spent the afternoon doing Porcupine Rim, Porcupine Trail, and parts of Fins and Things again. We rode for about 22 miles, and a good time was had by everyone. The bikes still works well, mostly, we're off to the Yamaha store tomorrow morning, to buy a new bark buster for Randy... Here are a few movies from the day as well:






Moab 2011: Day 2

With Randy's bike being basically in pieces, and not having the right tools to get it fixed, we decided to drop it off at the local Yamaha dealer here in Moab. They were great, took in the bike immediately, and promised to have it done today. After that, and the mandatory Egg McMuffin, we went and rode Fins and Things and Porcupine Trail. I of course forgot the battery for the Lumix camera that I brought, so no good pictures of the great views, but here's one shot taken with the video camera:


We rode around for a couple of hours, and got a solid ~21 miles on the bikes again. In the afternoon, Ted (Randy's dad) arrived, and we all hung out waiting for Randy's bike to be fixed. We picked it up around 5.30pm, and went out for another 7 miles of "test riding" it, and viola, we have three bikes again! I've uploaded a few more movies to my Contour account, here are a few links again:





Looking forward to a good, long day of riding tomorrow, with no broken bikes (or bones).


Moab 2011: Day 1

This is obviously not the usual techno babble on this blog: This week I'm in Moab (Utah) with my buddy Randy riding our dirt bikes.


Unfortunately we've started off the week with a pretty rough start. Randy's bike is running like crap, and he ended up having to ride his dad's bike today. Even so, we got a nice ~22 miles on the bikes at and near Gemini Bridges. This is a beautiful place, and the "bridge" is pretty darn cool.

P1000202 P1000194

I've uploaded a couple of the videos: http://contour.com/stories/moab-day-1 and http://contour.com/stories/moab-day-1-2 .

I'm uploading a few pictures to Flickr as well, which I'll make available here soon. Tomorrow we'll hopefully head up to Porcupine rim in the morning, and perhaps Fins and Things in the afternoon. Another update tomorrow as well, stay tuned.


Fedora Core 15 and NIC devices ...

I've been upgrading our internal file server at home, and I've done that by rebuilding it in a separate box, and later moving the new drives over to the real server machine. This is all great. However, when I decided to do the final migration, I edited the IP on the "development" box to be the real server IP, but doing so instantly changes the IP on the machine. And therefore, I took out the old (in-use) server ... This seems like an incredibly bad idea, particularly for a server, but for any networking in general.

These changes should clearly not take effect until I either reboot, or restart the network services. What were they thinking?? Also, while I'm griping, why are there two sets of Firewall 'startup' and configs in Fedora Core 15? It's not enough to simply turn off the iptables service any more, you also have run system-config-firewall and turn it off from there (or manually edit its config file I guess).

I tip for the Fedora Core developers: FC (and RHEL) has always been about the server, please continue to make that the priority. All this focus on the desktop will only make you lose market share, Ubuntu alread does a good job there. At a minimum, if I cared about things such as Gnome 3, and automatic "firewalls" and what not, make it a special Fedora spin.

Filtering Drupal comment spam

I get a fair amount of comment spam on my blog, and even after I changed all comments to be moderated, the spammers still persist. I decided to do something about this, and working under the assumption that most spammers are from a few countries, I decided to implement a Geo-location filter for Apache Traffic Server. The code is currently available at http://svn.apache.org/repos/asf/trafficserver/plugins/geoip_acl/, and only works with MaxMind's APIs (but I'd be more than happy to add support for other Geo-location APIs). This plugin also requires PCRE, but that's already a requirement for building ATS, so shouldn't be a problem.

Once compiled and installed (see the README), setting this up is fairly straight forward. In my remap.config, I now have the following rule

map http://www.ogre.com http://localhost:69 @plugin=geoip_acl.so @pparam=country \

This says to apply a country based Geo-location filter on this rule, using the additional configurations from deny_spam.conf. This file contains one single line:

^comment/       deny    CN RU IN

This might look draconian, but for now I'm disabling all comment posts from China, Russia and India. For more details on the plugin configurations and features, again see the README from the source above.




Subscribe to RSS - leif's blog