Friday 10 July 2020

Adjustment to df's output of squashfs mount points

Happy Friday,

Just wanted to announce the change to df's output has landed in groovy's
coreutils today.

df now omits devtmpfs and squashfs filesystems, by making gnulib treat
them as 'dummy' filesystems. This should make df's output a bit more
"crisp" for snap aficionados by excluding display of /snap/* (and /dev).

$ df -h | wc -l
42
$ sudo apt-get update
$ sudo apt-get install coreutils
$ df -h | wc -l
12

https://launchpad.net/ubuntu/+source/coreutils/8.30-3ubuntu3

This work is result of discussions with upstream. They suggested the
approach used in this patch, so while it's not landed in their master
branch yet, this should be close to what they'll be carrying.


Some additional technical details below...

On Mon, Jun 01, 2020 at 09:12:47AM -0700, Bryce Harrington wrote:
> On Mon, Jun 01, 2020 at 09:30:58AM +0100, Iain Lane wrote:
> > On Thu, May 28, 2020 at 09:38:47PM -0700, Bryce Harrington wrote:
> > > These days, df displays a lot of mount points, due to the increased use
> > > of non-consumable filesystems such as tmpfs and squashfs. This clutter
> > > is particularly noticeable using df in Ubuntu, due to the increased
> > > popularity of snaps, but the general problem affects all Linux distros,
> > > and shows up in other commands such as lsblk, blkid, fdisk -l, and
> > > mount.
> >
> > We had this problem on the desktop a while ago, and we worked with the
> > snapd team to solve it by introducing an extra option on the mounts
> > which snapd creates, called "x-gdu.hide". Parts of the GNOME desktop
> > respect this, and so user interfaces are not cluttered up with snap
> > mounts.
> >
> > https://github.com/snapcore/snapd/blob/31b6deca70ddabbc86ab2793ddf16e500ae66fde/osutil/squashfs/fstype.go#L67
> >
> > This feels to me to be a cleaner approach than saying that *all*
> > squashfs filesystems should be hidden by default - instead, the software
> > which creates the mounts is able to communicate this fact and if you've
> > created your own mounts then you carry on seeing them as normal.
>
> Thanks, that's a very good tip, I'll mention this to upstream.

I didn't get much discussion from upstream about use of "x-gdu.hide",
so I did some analysis myself. This property can be accessed via
libmount, however coreutils/gnulib explicitly does not use libmount as a
dependency since it has heavy dependencies. I'd be keen to know of
alternate ways to access this tag, because it does seem like a very
useful refinement.

> > There's still the question of creating an interface to hide based on
> > mount options and how to set the default. (Personally I agree with Seth
> > that the systemd style is a nice way to do it, if upstream are up for
> > that.) But this warrants consideration, I think.
>
> It sounds like upstream is preferring to avoid config files and env
> vars, and would prefer to filter squashfs as a dummy fs (if you look at
> `df -a` output you can see there are others already being filtered.) So
> given that I think they'll be interested in hearing about "x-gdu.hide"
> since that will more precisely target the issue we're trying to solve.

The response from upstream was to not use a config file or env var, to
avoid any security concerns, and just treat these as dummy filesystems.

Initially, they'd also considered excluding tmpfs, however there are
concerns that this would hide intentional tmpfs systems created by
users. I suspect for Ubuntu we ought to exclude tmpfs anyway, but have
left them as-is for now. (Perhaps something like "x-*.hide" could allow
distinguishing these.)

Bryce


> Thanks,
> Bryce
>
> --
> ubuntu-devel mailing list
> ubuntu-devel@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel

--
ubuntu-devel mailing list
ubuntu-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel