From fc3631b684a97c8f0f4389ffba6618208f0a9fed Mon Sep 17 00:00:00 2001
From: Michael Vogt <mvo@debian.org>
Date: Fri, 31 May 2013 21:01:45 +0200
Subject: [PATCH 1/2] add "size_{total,free}" to the "mount" facts

---
 system/setup | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/system/setup b/system/setup
index 5e4c76c3f3c..1e137e945cd 100644
--- a/system/setup
+++ b/system/setup
@@ -555,7 +555,16 @@ class LinuxHardware(Hardware):
         for line in mtab.split('\n'):
             if line.startswith('/'):
                 fields = line.rstrip('\n').split()
-                self.facts['mounts'].append({'mount': fields[1], 'device':fields[0], 'fstype': fields[2], 'options': fields[3]})
+                statvfs_result = os.statvfs(fields[1])
+                self.facts['mounts'].append(
+                    {'mount': fields[1],
+                     'device':fields[0],
+                     'fstype': fields[2],
+                     'options': fields[3],
+                     # statvfs
+                     'size_total': statvfs_result.f_bsize * statvfs_result.f_blocks,
+                     'size_free': statvfs_result.f_bsize * statvfs_result.f_bfree,
+                     })
 
     def get_device_facts(self):
         self.facts['devices'] = {}

From fcfc9f51947af7044e93bbe719ee4ea372d3ef65 Mon Sep 17 00:00:00 2001
From: Michael Vogt <mvo@debian.org>
Date: Fri, 31 May 2013 21:20:40 +0200
Subject: [PATCH 2/2] use statvfs.f_bavail to match the output of "df -B1"

---
 system/setup | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/system/setup b/system/setup
index 1e137e945cd..7d6173301de 100644
--- a/system/setup
+++ b/system/setup
@@ -561,9 +561,9 @@ class LinuxHardware(Hardware):
                      'device':fields[0],
                      'fstype': fields[2],
                      'options': fields[3],
-                     # statvfs
+                     # statvfs data
                      'size_total': statvfs_result.f_bsize * statvfs_result.f_blocks,
-                     'size_free': statvfs_result.f_bsize * statvfs_result.f_bfree,
+                     'size_available': statvfs_result.f_bsize * (statvfs_result.f_bavail),
                      })
 
     def get_device_facts(self):