|Systemd? You Aint Seen Nothing Yet!|
|Written by Mike James|
|Monday, 08 September 2014|
Lennart Poettering has caused a big stir in the Linux world with his systemd approach to configuration. Now he has suggested a new way of building distros and getting your code into the users hands and its all based on Btrfs.
There are a number of problems that the scheme proposed by Poettering and the systemd core developers aim to solve. The main complaint is that Linux distributions don't get applications into the hands of end users in anything like an efficient way. Each distro uses its own package system to all users to customize the OS by installing what they want to use. This means that if you develop a new app you have to wait until the distro gets round to packaging for you. In addition packages suffer from dependency hell and this makes life tougher for the potential user.
The Lennart solution is to make use of features of the B-tree file system. At the moment Btrfs is part of the kernel and generally considered to be an advanced file system - even though few people use it. It was originally invented at Sun/Oracle and is currently maintained by Facebook.
The idea is to make use of name spacing in the file system to allow programmers to provide their applications as loadable sub-volumes. The idea is to have a naming scheme like:
for application bundles. For example:
Similar naming schemes for a range of other standard OS parts is also used - root: for the core OS, usr: for the user file system, home: for a specific user's home directory and so on. On a given volume there could be multiple root: and usr: sub-volumes and lots of app: sub-volumes.
The system boots from one of the root sub-volumes, then mounts a matching usr: sub-volume. When a user logs in the corresponding home: sub-volume is mounted. When an app is run the corresponding app: sub-volume is mounted to /opt/<vendorname>.
So if you want to distribute a new application all you have to do is create the appropriate Btrfs sub-volume and make it available to users.
The same scheme can be used to boot different configurations from the same storage device. It just becomes a matter of pick-and-mix sub-volumes. If you want to keep different development environments, different operating systems even then you can and change things around in no time at all.
If you are worried about keeping so many copies of the same code and data on a single volume then don't be because Btrfs is designed for de-duplication. Its basic implementation philosophy is copy-on-write, which only creates new physical copies if there is a difference.
There is more!
Using Btrfs' send and receive facility you can compute the diff of two file system versions. This can be used to create a binary delta, i.e. the difference between version 1 and version 2 of your application. You can then send this to the user's machine and they have the new version installed.
To quote from the blog entry that describes this idea:
"This is how we envision installation and updating of operating systems, applications, runtimes, frameworks. At installation time, we simply deserialize an initial send-and-receive delta into our btrfs volume, and later, when a new version is released we just add in the few bits that are new, by dropping in another send-and-receive delta under a new sub-volume name. And we do it exactly the same for the OS itself, for a runtime, a framework or an app. There's no technical distinction anymore. The underlying operation for installing apps, runtime, frameworks, vendor OSes, as well as the operation for updating them is done the exact same way for all."
To find out all the other slightly more minor advantages you will need to read the entire blog post. It is also going to be presented at October's LinuxCon Europe.
The systemd developers have started work on the idea and hope that others will join in. Of course there is likely to be a backlash from users who like Linux just as it is. From a user's point of view, however, the good old Linux file system structure is going to be relatively unchanged. What will change is how programmers distribute their apps and the updates to apps and how we can reconfigure the system we are using.
However, this probably isn't going to smooth the progress of this scheme. By adopting it the Linux community is basically accepting Btrfs as the standard file system and this isn't going to happen without a lot of turbulence. Some see it as bringing Linux into the 21st century and others see it as changing the basic Linux philosophy.
Interesting times indeed.
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Monday, 08 September 2014 )|