Benki → All Posts

⇠ previous page next page ⇢
Matthias #

Simulating bad drive blocks with Device Mapper

Say you have a 0.5 MiB (= 1,024 sectors of 512 bytes each) drive at /dev/loop1 and would like to boot it with QEMU while simulating a broken sector at position 256.

You can use dm-error for this.

Write the following into a file and call it broken-drive.dm:

0 256 linear /dev/loop0 0
256 1 error
257 767 linear /dev/loop0 257

Alternatively, you can make use of dm-flakey to simulate a sector that is only sometimes broken, or that does something even worse such as drop any writes made to it. For example:

0 256 linear /dev/loop0 0
256 1 flakey /dev/loop0 256 5 5
257 767 linear /dev/loop0 257

Refer to the documentation of dm-flakey on how exactly it works and what the parameters are that it expects.

Create a virtual device at /dev/mapper/broken-drive using dmsetup create:

dmsetup create broken-drive <broken-drive.dm

You can now use it with QEMU just like any other drive or drive image.

A Java source code transformation engine, usable for refactoring, API migration, and such.

Matthew Yglesias on the housing crisis.

I wasn’t aware that zoning rules are as strict as they are. It sounds a bit insane. I wonder what it’s like in Germany—probably no better if I were to guess.

But I suppose that in addition to a NIMBY vs. YIMBY question it is also an instance of the principle of trying to protect people by taking choices away from them. I wonder how often that works.

A test suite generator for Java. Attempts to automatically generate JUnit test suites that target a given coverage criterion by searching the space of unit tests, encoding in them the current behavior of the code.

Keymaps for keyboards with programmable firmware.

The only one for NEO (my preferred layout) appears to be for the Kyria, but I’m sure it can serve as good inspiration for other keyboards.

Summary: Only log errors that require intervention, nothing else.

In general that’s reasonable advice and the article makes some good points, which are:

  • logging is not free; it has a non-negligible performance impact
  • there are better tools for most of the problems that people tend to use logs to solve

I would add:

  • logs are a user interface; it is important to keep them minimal so that they stay usable

But some of the details don’t really make sense.

The article suggests using plain println in order to avoid overhead, but in fact access to stdout/stderr is typically what’s most expensive about logging, which actual logging frameworks mitigate by offloading it to a worker thread.

The author recommends not to log progress but to use metrics instead. Surely having metrics is a good idea, but in batch processing, logging progress can make sense because it gives more immediate feedback after the rollout of a new version than metrics collection, which tends to be laggy.

There is also the implied assumption that you have a whole host of infrastructure at your fingertips that you can make use of to replace your logging, such as trace collection, metrics collection, and so on. That may be true in a Cloud environment, but in other environments such things may be more expensive to maintain.

Overall I agree with the notion that you should err on the side of logging less rather than more. But if you do have something to log, then (1) do it freely and (2) use a proper logging framework.

My build recipe for a runtime container image based on UBI Micro1 and the latest feature release of OpenJDK.

Small, secure, and tracks OpenJDK upstream. If you like to be on the latest OpenJDK (rather than some vendor’s LTS), this is for you.

I use it for this website and am very happy with it.

Footnotes:

  1. UBI is a trimmed-down version of RHEL that Red Hat distribute free of charge as part of their container image offerings.

A general-purpose physics simulation library with a focus on both speed and accuracy. Suitable for biomechanical, robotic, and other research-related simulations as well as graphics animation (such as in video games).

Has a C API, which makes it easy to bind to from any language.

A Java library for event sourcing. Based on the Cloud Events specification and designed to be a library of utilities rather than a framework.

⇠ previous page next page ⇢