Edit report at https://bugs.php.net/bug.php?id=65446&edit=1
ID: 65446
Comment by: puciek at gmail dot com
Reported by: puciek at gmail dot com
Summary: disk_total_space doesn't work with LVM
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Centos, Gentoo, Ubuntu
PHP Version: 5.4.17
Block user comment: N
Private report: N
New Comment:
df with parameter "-h" changes the output data from bytes to more human
readable
format
-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
Previous Comments:
------------------------------------------------------------------------
[2013-08-27 08:26:32] [email protected]
I cannot reproduce, tested with
PHP 5.4.19 / RHEL-6
PHP 5.5.3 / Fedora 19
As this function is a simple wrapper other the statvfs (or statfs), I don't
think of a PHP bug.
What is the option used in the test call ?
------------------------------------------------------------------------
[2013-08-13 21:21:13] puciek at gmail dot com
Description:
------------
Running disk_total_space on a system that is using LVM it will return
completely
incorrect data.
For example on a machine with result of "df -h" as follows:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-vg_root 99G 47G 47G 50% /
tmpfs 32G 0 32G 0% /dev/shm
/dev/sda1 194M 65M 120M 36% /boot
/dev/mapper/vg-vg_backup 400G 33M 400G 1% /var/tmp
/dev/mapper/vg-vg_mysql 950G 81G 870G 9% /data
on this setup it will always return 32G.
We get similar result on second machine with "df -h":
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/batty-root 258G 217G 29G 89% /
none 4.0G 208K 4.0G 1% /dev
none 4.0G 0 4.0G 0% /dev/shm
none 4.0G 88K 4.0G 1% /var/run
none 4.0G 0 4.0G 0% /var/lock
none 4.0G 0 4.0G 0% /lib/init/rw
none 258G 217G 29G 89% /var/lib/ureadahead/debugfs
where it will always return 4G.
At first that it was because of outdated version of PHP, original tests were
with PHP version 5.3.27 and 5.3.6, but then I was able to reproduce it on my
testing box with Gentoo and PHP 5.4.17.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65446&edit=1