Filesystem usage not show correctly when lvm logical volume is too long
short description
If lvm logical volume is too long, the disk usage is not show correctly
correct behaviour
The filesystems usage must be show correctly also in this case
environment
Server OS: (centos 6)
Server OS version: CentOS release 6.9 (Final)
ISPConfig version: (3.1.11)
On my system the df command used from ispc show this output:
[root@s-ispc-c3 ispconfig]# df -hT -x simfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_sispcc1-lv_root
ext4 7,7G 2,9G 4,5G 39% /
tmpfs tmpfs 1,9G 0 1,9G 0% /dev/shm
/dev/sda1 ext4 477M 180M 272M 40% /boot
/dev/mapper/vg_sispcc1-lv_var
ext4 136G 120G 9,2G 93% /var
Then the usage of root and var FS is not reported into disk usage page
proposed fix
Use the -P option in 'df' command to solve the issue:
-P, --portability
use the POSIX output format
This is ispc df output with -P option:
[root@s-ispc-c3 ispconfig]# df -PhT -x simfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_sispcc1-lv_root ext4 7,7G 2,7G 4,6G 37% /
tmpfs tmpfs 1,9G 0 1,9G 0% /dev/shm
/dev/sda1 ext4 477M 180M 272M 40% /boot
/dev/mapper/vg_sispcc1-lv_var ext4 136G 120G 9,1G 93% /var
This is proposal patch
--- /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php.orig 2018-02-02 15:19:28.778921392 +0100
+++ /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php 2018-02-02 15:53:11.169589836 +0100
@@ -74,7 +74,7 @@
$app->uses('getconf');
$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
- $dfData = shell_exec('df -hT -x simfs | awk \'!x[$1]++\' 2>/dev/null');
+ $dfData = shell_exec('df -PhT -x simfs | awk \'!x[$1]++\' 2>/dev/null');
// split into array
$df = explode("\n", $dfData);
With this patch and after run /usr/local/ispconfig/server/cron.sh the disk usage is show correct
Thanks
Dario Lesca