Archive for February, 2009

Local backups with rsync (forget tar -cvf – . | (cd /dest; tar -xpf -)

February 9, 2009

Recently, I encountered the rsync man page by accident (maybe as one of the lines in the top 10 Google search results?) and was quite surprised to find rsync examples where there was no remote host in any of its arguments. Doesn’t rsync stand for something like "remote synchronization"?

So here’s how it works:

If you want to copy all files in a directory and all directories and files below to another directory (for example on another file system on a different disk), use the following command:

$ rsync -avz /source_dir/ /dest_dir

Note the added slash after /source_dir. This command will recursively copy all files and directories in directory /source_dir to directory /dest_dir (will create it if it doesn’t exist). If you omit the trailing slash, it will create a new directory /dest_dir/source_dir. The rsync command will copy links as links, not as the original files they point to (similar to the default behavior of Solaris or GNU tar). If the rsync command was run before at least once, it will copy only the changed or newly added files. It will not remove destination files if files have been removed in the source directory.

Example: Copy all directories and files in directory /tmp/1 to empty directory /tmp/2:

  • Using the cp command (option P will copy links as links):
    $ cp -Ppr /tmp/1 /tmp/2
  • Using the tar command (Solaris or GNU. Solaris tar will report that a link has been created while GNU tar will only mention the file name of the link):
    $ mkdir /tmp/2
    $ cd /tmp/1
    $ tar -cvf - . | ( cd /tmp/2; tar -xpf -)
  • Using the rsync command:
    $ rsync -avz /tmp/1/ /tmp/2

Firefox for Solaris – latest versions as of Feb. 2009

February 9, 2009

These are the direct links for downloading the latest versions of Firefox for Solaris:

Version x86 SPARC
Firefox 3.0.6 OpenSolaris pkg  |  tar pkg  |  tar
Firefox 3.0.6 Solaris 10 pkg  |  tar pkg  |  tar
Firefox Solaris 10 pkg  |  tar pkg  |  tar
Firefox Solaris 8 pkg  |  tar pkg  |  tar

Note that you can easily install multiple version of Firefox on Solaris, using either the tarballs or my script for renaming a Firefox package.

How to save a lot of money

February 4, 2009

Good news: You can save a lot of money easily! Here’s how it works:

Go to (for the US or Canada) or (for Europe) or a similar site where car drivers can enter data of their cars and their tank fillings. Search for similar cars like yours (same engine/power/cylinder capacity, same year of manufacture), look for the average and also for the lowest fuel consumption of these cars (maybe also for the highest).

Let’s take the 2004 Toyota Prius. The average range is 46.3 mpg but the best is 62 mpg! Even if you do are not the perfect eco driver, you might be able to achieve 60 miles per gallon.

Suppose you are typically driving 20,000 miles a year. That’s 20,000/46.3 = 432 gallons of fuel for the average 2008 Prius. Now let us do the same calculation for the fuel efficient driver: 20,000/60 = 333.3 gallons. Considering a price of 1.7 US $ per gallon, that’s about $165 less (870.5 kg less CO2) per year. Not too bad!

What about the 2004 Ford F150 Pickup 2WD 8 cyl 5.4 L? Average mpg is 15.3, worst is 12 and best is 19 mpg. For 20,000 miles a year, that would be 20,000/15.3 = 1,307.2 gallons in average or 1,052.6 for the best driver. Difference is more than $432, so you should be able to save more than $400 (2.25 metric tons CO2) per year (and even more if you are used to driving at high speed and/or with too low air pressure in your tires, or if you use your car instead of your bike for getting fresh rolls in the morning)! For just a fraction of the saved money, you could buy a good computer racing game. Or do indoor cart racing once a year.

For those of you living in Europe, you will save even more (as fuel prices are a lot higher than in the U.S.). In my case, for about 20,000 km (12,427 mi) per year on a Toyota Corolla Combi 1.6 (station wagon), I achieved 5.7 liters per 100 km (41 mpg) in average, compared to 7.5 liters per 100 km (31.4 mpg) for the average driver. With a fuel price of 1.39 EUR per liter (5.25 EUR per gallon), I saved about 500 EUR (and more than 800 kg CO2) per year compared to the average driver, or twice as much compared to a driver that prefers an F1 driving style.

And this is the "car" I am using for short distances, including shopping in my home village – saved me another 100 EUR (plus the fitness center fees) and 160 kg CO2 per year:

Shopping Bike