Prefetch Technologies // Keeping your cache lines cozy

Archive

Posts in Linux

Printing the current sector size of a device in Linux

linuxApr 19, 2011 1 min read

In the past year, a number of disk drives started shipping with 4K sector sizes. To see if your disk drive is using 512-byte or 4K sectors, you can use the blktool utility to print the sector size of a device: You can also look at the hw_sector_size value for a given device in /sys, but who wants to do that when a sweet little utility like blktool exists. There are various other ways to do this, and you comments and suggestions are welcome. :)

$ read more →

Configuring NSCD to cache DNS host lookups

networkinglinuxsolarisMar 27, 2011 3 min

I haven't really spent that much time configuring nscd, so I thought I would take a crack at it this morning while sipping my cup of joe. Looking at one of my production hosts, I queried for the "host" cache statistics. This is the nscd cache which keeps DNS lookups. With the nscd daemon running, you can query the size / performance of the caches with the -g flag…

$ read more →

Continuing to tail a file after it's been rotated

linuxMar 27, 2011 1 min

I use xtail and tail quite a bit to debug problems. Sometimes when I'm up late at night troubleshooting issues, the log rotation jobs will kick off and my tail session will stop updating (tail will follow the file descriptor associated with the file by default, not the name of the file). Since this can make debugging an issue a bit confusing, I've made it a habit to alias tail to something like this: The "--follow=name" option will cause tail to follow the name of the file and not the file descriptor, and the "--retry" option will cause tail to try to re-open the file if it's not accessible (log rotation events will cause the file to change). It's become second nature to run tailer now, and I don't get that "WTF?!?" moment at 2am now…

$ read more →

A simple and easy way to restart dropped SSH sessions on Linux servers

linuxsecurityMar 24, 2011 1 min

I frequently use OpenSSH port forwards to move around my various networks, and there is nothing worse than an SSH connection dropping when you make heavy use of them. Recently I came across the autossh utility, which provides a crazy easy way to monitor ssh sessions and restart them when they are reset or dropped. To use this awesome little tool, you can invoke autossh with the options you would normally pass to your ssh client: In the example above I am creating a dynamic local port forward that will accept connections on localhost:8000. To change how autossh manages the sessions and logs it creates, you can set one of more environment variables…

$ read more →

Who says Linux isn't stable?

linuxMar 22, 2011 1 min

I have been replacing some old hardware over the past few months, and recently noticed that we had several machines with uptimes in the hundreds of days (one 800+ days). For the longest time I thought only Solaris and AIX provided this kind of stability, but over the past few years I've started to include Linux in this list as well. You gotta love it when you see this: Now if only ksplice would make it into the Enterprise distributions! That would be rad, and I'm sure some fun "my uptime is better than your uptime" threads would ensue…

$ read more →