Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk_total_size calculation error on btrfs with subvolumes #102

Open
Schroedingersdoraemon opened this issue Aug 16, 2022 · 0 comments
Open

Comments

@Schroedingersdoraemon
Copy link

Schroedingersdoraemon commented Aug 16, 2022

Dear teddysun,

I am using btrfs with subvolumes:

$ btrfs subvolume list / 
ID 256 gen 1430873 top level 5 path @
ID 257 gen 1430873 top level 5 path @home

The disk_total_size in the script will seemingly calculate the sum of all the subvolumes, producing a multiplied and redundant result.

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 119.2G  0 disk 
└─sda1        8:1    0 119.2G  0 part /var/lib/libvirt/images
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:1    0   128M  0 part /boot
├─nvme0n1p2 259:2    0     8G  0 part 
└─nvme0n1p3 259:3    0 468.8G  0 part /home
                                      /
$ df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap --total -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p3  469G  360G  107G  78% /
/dev/nvme0n1p1  127M   73M   54M  58% /boot
/dev/nvme0n1p3  469G  360G  107G  78% /home
/dev/sda1       117G  106G  5.7G  95% /var/lib/libvirt/images
total           1.1T  826G  219G  80% -

The correct answer should be 117 G + 469G + 127M $\approx$ 586 G,
whilist here the unnecessary addition of a subvolume of 469G was added,
the result became 586 G + 469 G $\approx$ 1.1 T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant