Skip to content

How to use --fs= when device names aren't stable? #420

@martinvonwittich

Description

@martinvonwittich

I have a server that has two filesystems:

git.company.tld ~ # lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0   500G  0 disk 
|-sda1   8:1    0   100M  0 part 
`-sda2   8:2    0 499.9G  0 part /
sdb      8:16   0     4T  0 disk 
`-sdb1   8:17   0     4T  0 part /srv
git.company.tld ~ # sar -F -s 14:00
Linux 6.1.0-41-amd64 (git.company.tld)     01/12/26        _x86_64_        (4 CPU)

14:00:09     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM
14:10:09       107280    396403     78.70     82.83  31889739    814261      2.49 /dev/sda2
14:10:09      1018449   3108942     75.32     80.15 251936094  16499362      6.15 /dev/sdb1
Summary:       107280    396403     78.70     82.83  31889739    814261      2.49 /dev/sda2
Summary:      1018449   3108942     75.32     80.15 251936094  16499362      6.15 /dev/sdb1

I can select a specific filesystem in sar e.g. with --fs=/dev/sdb1:

git.company.tld ~ # sar -F -s 14:00 --fs=/dev/sdb1
Linux 6.1.0-41-amd64 (git.company.tld)     01/12/26        _x86_64_        (4 CPU)

14:00:09     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM
14:10:09      1018449   3108942     75.32     80.15 251936094  16499362      6.15 /dev/sdb1
Summary:      1018449   3108942     75.32     80.15 251936094  16499362      6.15 /dev/sdb1

But apparently, I can not select it by mountpoint, even though the manpage says so?

       --fs=fs_list
              Specify the filesystems for which statistics are to  be  displayed  by  sar.   fs_list  is  a  list  of
              comma-separated filesystem names or mountpoints.
git.company.tld ~ # sar -F -s 14:00 --fs=/srv     
Linux 6.1.0-41-amd64 (git.company.tld)     01/12/26        _x86_64_        (4 CPU)

14:00:09     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM

Unfortunately, the device names aren't stable between reboots - the server was rebooted today, and in the datafile from yesterday, /dev/sda and /dev/sdb were swapped:

git.company.tld ~ # sar -f /var/log/sysstat/sa20260111 -F -s 23:40
Linux 6.1.0-41-amd64 (git.company.tld)     01/11/26        _x86_64_        (4 CPU)

23:40:00     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM
23:50:00       106689    396994     78.82     82.95  31890860    813140      2.49 /dev/sdb2
23:50:00      1022314   3105076     75.23     80.06 251669381  16766075      6.25 /dev/sda1
Summary:       106689    396994     78.82     82.95  31890860    813140      2.49 /dev/sdb2
Summary:      1022314   3105076     75.23     80.06 251669381  16766075      6.25 /dev/sda1

This makes it tricky to extract data from multiple datafiles at the same time, because now I have to know which way the devices were swapped for each datafile. I tried to use /dev/disk/by-uuid, but apparently that doesn't work:

git.company.tld ~ # ll /dev/disk/by-uuid/83cad40a-92dd-4a30-b203-dbfd8e05ae2e
lrwxrwxrwx 1 root root 10 Jan 12 07:53 /dev/disk/by-uuid/83cad40a-92dd-4a30-b203-dbfd8e05ae2e -> ../../sdb1
git.company.tld ~ # sar -F --fs=/dev/disk/by-uuid/83cad40a-92dd-4a30-b203-dbfd8e05ae2e
Linux 6.1.0-41-amd64 (git.company.tld)     01/12/26        _x86_64_        (4 CPU)

00:00:00     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM

04:30:00     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM

07:53:55     LINUX RESTART      (4 CPU)

08:00:09     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM

12:30:09     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM

Is there a solution that I'm overlooking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions