Expect the unexpected

“You sound like a broken record” Is something we complain when someone repeats again and again the same concepts. But even broken disks can sometime be useful DISCLAIMER: No filesystem or device were harmed in the making of this experiment 😉 Image credits: Mick Haupt In this article I would like to explore the powerful tools we have in Linux to simulate dealing with broken disks, that is, drives that more or less randomly report errors....

November 19, 2023 · Andrea Manzini

Quiet fans on Thinkpad P15

Intro The Thinkpad P15 laptop is a nice linux machine, but there is an annoying detail, as Arch wiki writes: “The default operation of fans is noisy, as they are basically at medium power all the time. The thinkfan program can be used to create a quieter operation, while retaining reasonable temperatures.” . Let’s make it quieter. Prerequisite Install thinkfan rpm package and enable the daemon: # zypper in thinkfan && systemctl enable --now thinkfan Make sure modules are loaded at startup with the options to override fan control and enable experimental features:...

September 1, 2023 · Andrea Manzini

linux: how to access DHCP options from client

As you may know, you can configure any DHCP server to send many options to the clients; for example to setup dns domains, http proxy (WPAD) and so on. If you need to access these options from a linux client, you must configure the client to ASK the server for the new options, by editing /etc/dhcp/dhclient.conf, and add an entry like: option WPAD code 252 = string; also request WPAD; done that, when you’ll ask for a dhcp, the dhclient process will invoke your hook scripts with two new environment variables, old_WPAD and new_WPAD, with the values before and after the renewal....

November 6, 2017 · Andrea Manzini

convert a binary file to ascii using hexdump

I have a binary file with data stored as two-byte big-endian 16-bit words. We need to extract the values in the file and print them in decimal ASCII format, so to obtain numbers in the 0-655535 range. let’s create the sample file: $ echo -en "\x01\x02\x03\x04\x05\x06\x07\x08" > file.bin and show its content in binary form: $ hexdump -C file.bin 00000000 01 02 03 04 05 06 07 08 |........| 00000008 to get the desired output we can use the powerful, but little documented format string option of hexdump:...

October 20, 2016 · Andrea Manzini