Tuesday, June 25, 2019

util-linux v2.34 -- what's new?

The code of the popular command lsblk(8) has been completely rewritten. The result is more extendible and readable code. Now lsblk(8) keeps all block devices tree in memory before it's printed. It allows to modify and reorder the tree independently on the way how kernel (/sys filesystem) exports the tree to userspace. The new features based on this change are:
  • devices de-duplication (e.g. lsblk --dedup WWN); this is useful for example on systems with multi-path devices where the same device is accessible by more ways
  • M:N relationships without repeating devices (e.g. lsblk --merge); this feature is implemented by additional tree graph.
For example visualization of really complicated setup; thin provisioning pool with external snapshot (the pool is based on loop0 and it's created by metadata and data devices; the pool and loop1 are used for the snapshot).

$ lsblk --merge
       NAME                 MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
       loop0                  7:0    0 955.7M  0 loop  
   ┌┈▶ ├─test-thin-metadata 253:0    0     2M  0 dm    
   └┬▶ └─test-thin-data     253:1    0 953.7M  0 dm    
┌┈▶ └┈┈test-thin-pool       253:2    0 953.7M  0 dm    
┆      └─test-thin          253:3    0 190.8M  0 dm    
└┬▶    loop1                  7:1    0 190.8M  0 loop  
 └┈┈┈┈┈test-thin-extsnap    253:4    0 190.8M  0 dm    

The same situation with classic lsblk output:

$ lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                     7:0    0 955.7M  0 loop  
├─test-thin-metadata    253:0    0     2M  0 dm    
│ └─test-thin-pool      253:2    0 953.7M  0 dm    
│   ├─test-thin         253:3    0 190.8M  0 dm    
│   └─test-thin-extsnap 253:4    0 190.8M  0 dm    
└─test-thin-data        253:1    0 953.7M  0 dm    
  └─test-thin-pool      253:2    0 953.7M  0 dm    
    ├─test-thin         253:3    0 190.8M  0 dm    
    └─test-thin-extsnap 253:4    0 190.8M  0 dm    
loop1                     7:1    0 190.8M  0 loop  
└─test-thin-extsnap     253:4    0 190.8M  0 dm    

You can see that lsblk repeating test-thin and test-thin-extsnap, and loop1 seems unrelated for the setup at first glance.

The repeating of the block devices in the output is more annoying for multi-path devices. See another example in my previous blog: https://karelzak.blogspot.com/2018/11/lsblk-merge.html

I guess that FUSE user will be very happy with v2.34; finally the command umount(8) supports non-root user unmount for FUSE mounts. The requirement is FUSE specific user_id= in /proc/self/mountinfo for the filesystem. So, you do not have to call fuse specific umount tool, just use umount(8) as usually.

The command mount(8) now allows to use "--all -o remount" to remount all filesystems with specified or fstab options. It's possible to use filters (-t and -O).

The new command hardlink has been merged to util-linux. The command consolidates duplicate files via hardlinks. The current implementation is from Fedora, but in the next versions we will reuse also code from Debian fork to create one widely usable implementation.

The command lscpu(1) now prints more information about your CPU, for example 'Frequency boost' and 'Vulnerability' fields. The caches calculation has been modified to print summary from all system caches rather than per code numbers; and new command line option --caches lists details about CPU caches.

... and many another small changes :-) See complete release notes at kernel.org: https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.34/v2.34-ReleaseNotes

Thanks to Sami Kerola, Stanislav Brabec, Ruediger Meier and others!