Howto speed up your apt-get like never before

… is quite simple. You get your hands on eatmydata. Yes it’s not a convincing name but hey it’s in the standard repositories of debian and ubuntu so it should do you no harm 🙂

sudo apt-get -y install eatmydata

How to use it

sudo eatmydata apt-get <your regular stuff / install / update /...>

Try it on installs. It is SO MUCH FASTER.

Why the speed? Are there risks?

Normally programs like apt-get are very much power-loss persistent. If there is a sudden power loss you can pretty much resume where you got interrupted. This is possible because apt-get checks often if the data that should be on the disk is really written to it. Old school nerds may know the tool “sync” which is basically what apt-get does a lot.

This is very time consuming because file systems like ext4 and btrfs are not used to being forced to write all the time. They want to keep stuff in buffers and write when they decide it’s time. The is part of the magic speed they can achieve. Eatmydata redirects calls from following programs to sync-like functions programs into the void. Eatmydata makes other programs think they work pretty safe but actually they are not (and hell of a lot faster).

So it’s really fast but you really shouldn’t loose power (or sth. similar) when using eatmydata. But hey my last power failure is years from now and how are the chances you’re using eatmydata in this very moment? I wouldn’t recommend it for cronjobs though.

Update: Problems with Xbian on the Raspberry PI (rpi)

Looks like eatmydata causes problems on the raspberry pi with xbian installed. apt-get / dpkg exits with an error from time to time. But one can always proceed with

sudo dpkg --configure -a

But nevertheless eatmydata is not recommended for the rpi.

Wake on lan remote control

I’ve written a small script to remote control a computer via wake on lan (WOL) packages. This could come in quite handy if my raspberry pi finally arrives but any HTPC owner could make use of this too. (You don’t want to run xbmc along with your torrent client (and vice versa) all day long, do you?)

It’s available here: https://sourceforge.net/projects/wolrc/

How it works:

It basically executes predefined commands on the amount of WOL packages received without a timeout. Just arm your android smartphone with a WOL app, send e.g. two WOL pkgs and your box will execute whatever you told it to do. It needs root (because it depends on pcapy ) so you’re strongly advised to use sudo wherever you can.

Note (Update):

AFAIK the raspberry pi is not capable of booting up due to a WOL package. Of course it can receive and handle them nonetheless.

 

Automated shutdown paranoid edition

One time I relied heavily on the ntfs-3g driver and it killed my ntfs-partition. Since then I always check if any mounted ntfs partition is umounted properly. For automation here is a code snippet for debian (ubuntu?). If a mount point in /media cannot be unmounted there will be no shutdown.

for f in `mount | grep /media/ | awk '{ print $1; }'`;
do 

! umount $f && exit

done

shutdown -h 1