Skip to content

[FEAT] Print btrfs subvolumes like the zpool storage pools #1262

Closed
@danie-dejager

Description

@danie-dejager

Be sure to read FAQ before submitting a new issue.

Wanted features:

I would like to only print the btrfs sub-volumes similar to the following only printing ZFS zpools.
fastfetch -s zpool -l none
Zpool (zhome): 1.05 MiB / 3.75 GiB (0%, 0% frag) - ONLINE

When I run:
fastfetch --disk-show-subvolumes -l none
I get all info including the drives which is not what I wanted to see.
fastfetch --disk-show-subvolumes -l none | grep btrfs

Disk (/opt/devops/automation): 184.15 MiB / 3.00 GiB (6%) - btrfs
Disk (/tmp): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]
Disk (/usr/share/locale): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]
Disk (/usr/share/man): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]
Disk (/var/cache/dnf): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]
Disk (/var/log): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]
Disk (/var/log/audit): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]
Disk (/var/tmp): 184.15 MiB / 3.00 GiB (6%) - btrfs [Subvolume]

Those are not disks but subvolumes in btrfs FS as you stated at the end of the line. There's also a lot of info that one could get for ZFS and btrfs volumes to present it to users in a more consistent manner:

→ btrfs filesystem show /dev/nvme2n1
Label: 'system_vol'  uuid: 65998469-344d-4cd9-a423-e7a9d81ad41c
	Total devices 1 FS bytes used 166.72MiB
	devid    1 size 3.00GiB used 1.14GiB path /dev/nvme2n1

→ btrfs filesystem usage /var/log
Overall:
    Device size:		   3.00GiB
    Device allocated:		   1.14GiB
    Device unallocated:		   1.86GiB
    Device missing:		     0.00B
    Device slack:		     0.00B
    Used:			 181.70MiB
    Free (estimated):		   2.33GiB	(min: 1.40GiB)
    Free (statfs, df):		   2.33GiB
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		   3.50MiB	(used: 0.00B)
    Multiple profiles:		        no

Data,single: Size:640.00MiB, Used:154.51MiB (24.14%)
   /dev/nvme2n1	 640.00MiB

Metadata,DUP: Size:256.00MiB, Used:13.58MiB (5.30%)
   /dev/nvme2n1	 512.00MiB

System,DUP: Size:8.00MiB, Used:16.00KiB (0.20%)
   /dev/nvme2n1	  16.00MiB

Unallocated:
   /dev/nvme2n1	   1.86GiB

Motivation:

I want to make it easier for my users to see what zpools and btrfs volumes are on the systems when they login. Can the feature to print btrfs volumes and subvolumes be added like zpool was added?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions