php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65446 disk_total_space doesn't work with LVM
Submitted: 2013-08-13 21:21 UTC Modified: 2013-10-03 06:49 UTC
Votes:3
Avg. Score:3.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: puciek at gmail dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.4.17 OS: Centos, Gentoo, Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: puciek at gmail dot com
New email:
PHP Version: OS:

 

 [2013-08-13 21:21 UTC] 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.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-27 08:26 UTC] remi@php.net
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-27 08:29 UTC] puciek at gmail dot com
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)
 [2013-08-27 09:30 UTC] remi@php.net
-Status: Open +Status: Feedback
 [2013-08-27 09:30 UTC] remi@php.net
I was asking for the option given to the disk_total_space call.
 [2013-08-27 10:29 UTC] puciek at gmail dot com
Director inside LVM share which we want to measure
 [2013-08-27 11:25 UTC] remi@php.net
I means which "exact" value for directory option.

If you use "/dev/mapper/batty-root" which is only a file (ok, a special one) it will report about space in /dev (so 4G)

If you use "/" it will report about space in /
 [2013-10-03 06:49 UTC] remi@php.net
-Status: Feedback +Status: No Feedback
 [2013-10-03 06:49 UTC] remi@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 14:01:27 2019 UTC