Opennebula shows wrong datastore capacity

Pavel Tankov asked:

I have installed OpenNebula following the quickstart guide OpenNebula on CentOS 6 and KVM.

I am using all local hard disks. I have one huge software RAID10 array composed of 4 partitions, no LVM whatsoever. The raid device is /dev/md2 and is mounted on /var/lib/one/datastores.

Here is the disk space as reported by CentOS:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/md2        7.1T  177M  6.8T   1% /var/lib/one/datastores

and here is the disk usage as reported by CentOS:

$ du -shc /var/lib/one/datastores
20K     /var/lib/one/datastores
20K     total

so, the folder seems pretty much empty (although I still don’t know why df -h says that 177M are used, but anyway).

and here is the contents of the folder:

$ ls -la /var/lib/one/datastores
total 24
drwxr-xr-x 6 oneadmin oneadmin 4096 Jul 31 18:19 .
drwx------ 8 oneadmin oneadmin 4096 Jul 31 18:33 ..
drwxrwxr-x 2 oneadmin oneadmin 4096 Jul 31 18:20 0
drwxr-xr-x 2 oneadmin oneadmin 4096 Jul 31 18:20 1
drwxr-xr-x 2 oneadmin oneadmin 4096 Jul 31 18:04 2
drwxr-xr-x 2 oneadmin oneadmin 4096 Jul 31 18:13 .isofiles

$ find /var/lib/one/datastores

The problem is that OpenNebula says my datastores are using 367.8GB when they should be empty. See the screen shot.

Update: I have tried stopping OpenNebula, deleting the database /var/lib/one/one.db and starting OpenNebula again with no positive result.

enter image description here

My answer:

By default 5% of a filesystem is reserved for use of the root user, and not otherwise available. This is visible in your df output as a ~300GB discrepancy between the total space and available space. OpenNebula appears to consider this space as unavailable when performing its calculation.

If you don’t want to reserve such space, then turn it off:

tune2fs -m 0 /dev/md2

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.