What happened to my machine?

Bob Proulx bob at proulx.com
Tue Jun 14 11:24:56 MDT 2022


Brian Sturgill wrote:
> OK, some good news and some bad news.
> The df output was coming from 20.04.4 (Focal Fossa)
>
> I have one with the weird /dev/mapper root and one without. Both show all
> the snaps.
>
> Now the good news is that I have one with 22.04... and its df doesn't have
> /dev/mapper or the snaps.

Basically the timeline is like this...  Ubuntu adds things like snaps
which were not filtered from df output by default by the upstream GNU
Coreutils project.  Everyone starts to see snaps, and complain.
Upstream Coreutils changes the filtering mechanism for df default
output.  Next version of Ubuntu pulls in the next upstream version of
GNU Coreutils df and this useless information is no longer showed by
default.

> They have added a -a flag which has a scary amount output.

That was added to df years and years ago.  You just never needed to
look at it before.  You can also look at proc mounts too.

    cat /proc/mounts

> But at least I can easily see how much disk space I'm using.

For a long time I have had a df wrapper script that filters out the
file types I didn't want to see.  Basically I do things like this to
filter the output and alias my use of df to it.

    /bin/df "$@" | awk '$NF!~/^\/run/&&$NF!~/^\/sys/&&$NF!~/^\/dev/&&$NF!~/^\/snap\//'

Sorry that will look like unreadable line noise.  Let me add some whitespace.

    /bin/df "$@" |
        awk '
	    $NF !~ /^\/run/ &&
	    $NF !~ /^\/sys/ &&
	    $NF !~ /^\/dev/ &&
	    $NF !~ /^\/snap\//
            { print }
	    '

I just hack on it as I need and it isn't very rigorously defined.  In
awk the NF variable is the Number of Fields.  Such as 6.  And $6, the
expansion of $NF, $6 will be the last field.  $NF in awk is the
typical idiom to get the last field.  So here I am matching on the
last field and filtering out those patterns.  The default action of
printing the line is used in my compact form since I did not include
any explicit action but I listed it in the expansion for clarity.

> Now the good news is that I have one with 22.04... and its df doesn't have
> /dev/mapper or the snaps.

The /dev/mapper being there is due completely to having LVM installed
and used on your system.  In the one case you installed with LVM and
in the other case you installed without LVM.

LVM was originally developed at HP back in the old days for server
storage management.  Then completely rewritten for GNU/Linux systems
as LVM2.  It's really a pretty cool feature.

If you have ever used a fully encrypted laptop then almost certainly
it used LVM to support the feature.  That's where most consumers
overlap with the default use of LVM.  In which case seeing an LVM LV
Logical Volume /dev/mapper/$name--$vg-$partition is perfectly normal.
In your case you must have typed in the name "dobby" at install time
when it asked you about it.

I always try to keep my VG volume group names short so that df output
is short.  I usually use a letter and a number.  But it can be
anything anyone wants arbitrarily.  here are a couple of examples from
two of my systems.  The first is a fully encrypted laptop and the
second one is a server.

    rwp at angst:~$ df -h
    Filesystem           Size  Used Avail Use% Mounted on
    /dev/mapper/v4-root  151G  132G   11G  93% /
    /dev/sda1            236M  100M  124M  45% /boot

    rwp at havoc:~$ df -h
    Filesystem           Size  Used Avail Use% Mounted on
    /dev/mapper/h9-root  5.4G  4.2G  925M  83% /
    /dev/md0             457M  119M  314M  28% /boot
    /dev/mapper/h9-tmp   8.3G  152K  7.9G   1% /tmp
    /dev/mapper/h9-var   5.7G  4.1G  1.4G  76% /var
    /dev/mapper/h9-home   35G   30G  3.3G  90% /home
    /dev/mapper/h9-debs  429G  249G  158G  62% /srv/debian
    /dev/mapper/h9-www   189G  150G   31G  83% /srv/www
    /dev/mapper/h9-bkpc   63G   39G   22G  65% /srv/backuppc
    /dev/mapper/h9-deb8  178G  133G   46G  75% /srv/deb8

You can see on the server that I have set up several dedicated
partitions to contain a couple of topic areas.

Bob


More information about the NCLUG mailing list