Titus Winters talks about maintaining and refactoring large C++ code bases (i.e. code bodies that require multi-step refactoring). He describes how “higher-level” language features effectively make refactoring harder (e.g. functions, classes, templates, concepts).
Category: English
Usefulness of Swap Explained
Chris Down explains how swap’s main role is being the missing backing store for anonymous (i.e. allocated by malloc
) pages. While all other kinds of data (e.g. paged in files) can be reclaimed easily and later reloaded, because their “source of truth” is elsewhere. There’s no such source for anonymous pages hence these pages can “never” be reclaimed unless there’s swap space available (even if those pages aren’t “hot”).
Linux has historically had poor swap (and by extension OOM) handling with few and imprecise means for configuration. Chris describes the behavior of a machine with and without swap in different scenarios of memory contention. He thinks that poor swap performance is caused by having a poor measure “memory pressure.” He explains how work on cgroup v2 might give the kernel (and thus admins) better measures for memory pressure and knobs for dealing with it.
6 weeks without the big 5
Kashmir Hill went 6 weeks without the big 5 tech giants (Amazon, Facebook, Microsoft, Google, Apple). It seems you basically have to become a level 5 vegan especially if you also avoid anything hosted/using their cloud services (e.g. AWS, Azure, GCloud).
Wrestling with the Python
Sometimes Python makes some useful things unnecessarily complex for weird and inconsistent reason … e.g. “code blocks.”
Naïvité FTW
Daniele Procida explores how a certain naivety (being unsophisticated) can lead to beautiful and useful things.
https://www.youtube.com/watch?v=niKV3ZMpilg
ECCploiting with Rowhammer
Certain types of ECC RAM can also be exploited with Rowhammer. ?
ZIO Pipeline
This is an awesome talk for nerding out on ZFS interna. ?
https://www.youtube.com/watch?v=qkA5HhfzsvM
Threads on async
If you were to design a threading library today how would it look like? David Beazley manages to demonstrate a lot of edge cases in tiny examples … while live-coding! ?
https://www.youtube.com/watch?v=xOyJiN3yGfU
systemd from BSD
A remarkably sober analysis of what problem systemd solves for Linux … at a BSD conference of all places. ?
https://www.youtube.com/watch?v=6AeWu1fZ7bY
Moving LXD Containers From One Pool to Another
When I started playing with LXD I just accepted the default storage configuration which creates an image file and uses that to initialize a ZFS pool. Since I’m using ZFS as my main file system this seemed silly as LXD can use an existing dataset as a source for a storage pool. So I wanted to migrate my existing containers to the new storage pool.
Although others seemed to to have the same problem there was no ready answer. Digging through the documentation I finally found out that the lxc move command had a -s option … I had an idea. ? Here’s what I came up with …
Preparation
First we create the dataset on the existing ZFS pool and add it to LXC.
1 2 | sudo zfs create -o mountpoint=none mypool/lxd lxc storage create pool2 zfs source=mypool/lxd |
lxc storage list should show something like this now:
1 2 3 4 5 6 7 | +-------+-------------+--------+--------------------+---------+ | NAME | DESCRIPTION | DRIVER | SOURCE | USED BY | +-------+-------------+--------+--------------------+---------+ | pool1 | | zfs | /path/to/pool1.img | 2 | +-------+-------------+--------+--------------------+---------+ | pool2 | | zfs | mypool/lxd | 0 | +-------+-------------+--------+--------------------+---------+ |
pool1 is the old pool backed by the image file and is used by some containers at the moment as can be seen in the “Used By” column. pool2 is added by not used by any contaiers yet.
Moving
We now try to move our containers to pool2.
1 2 3 4 | # move container to pool2 lxc move some_container some_container-moved -s=pool2 # rename container back for sanity ;) lxc move some_container-moved some_container |
We can check with lxc storage list whether we succeeded.
1 2 3 4 5 6 7 | +-------+-------------+--------+--------------------+---------+ | NAME | DESCRIPTION | DRIVER | SOURCE | USED BY | +-------+-------------+--------+--------------------+---------+ | pool1 | | zfs | /path/to/pool1.img | 1 | +-------+-------------+--------+--------------------+---------+ | pool2 | | zfs | mypool/lxd | 1 | +-------+-------------+--------+--------------------+---------+ |
Indeed pool2 is beeing used now. ? Just to be sure we check that zfs list -r mypool/lxd also reflects this.
1 2 3 4 5 6 7 | NAME USED AVAIL REFER MOUNTPOINT mypool/lxd/containers 1,08G 92,9G 24K none mypool/lxd/containers/some_container 1,08G 92,9G 704M /var/snap/lxd/common/lxd/storage-pools/pool2/containers/some_container mypool/lxd/custom 24K 92,9G 24K none mypool/lxd/deleted 24K 92,9G 24K none mypool/lxd/images 24K 92,9G 24K none mypool/lxd/snapshots 24K 92,9G 24K none |
Awesome!
⚠ Note that this only moves the container, but not the LXC image it was cloned off of.
We can repeat this until all containers we care about are moved over to pool2.
Cleanup
To prevent new containers to use pool1 we have to edit the default profile.
1 2 | # change devices.root.pool to pool2 lxc profile edit default |
Finally …. when we’re happy with the migration and we’ve verified that everything works as expected we can now remove pool1.
1 | lxc storage rm pool1 |