1. The setup
I have a 4 TB WD Red HDD with one ext4 partition /dev/sdb1
mounted on an Ubuntu 16 LTS Server under /DataVolume
. The mounted drive is then served on the network by a samba server.
Ubuntu Server is running on a virtual machine hosted by VMware ESXi 6.5.
On the ESXi the drive is setup as RDM (Raw Device Mapping).
The drive is empty (fresh after recreation of the partition table).
2. The problem
df -T /dev/sdb1
gives the following result:
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sdb1 ext4 3845577736 69648 3650140872 1% /DataVolume
Used space
Reported: 69648/1024 = 68, ... MB
Calculated: (3845577736 - 3650140872) / (1024 * 1024) = 186,... GB
The calculated used space is much more than the reported value.
Free space
3650140872 / (1024 * 1024 * 1024) = 3,39 ... TB
Capacity
3845577736 / (1024 * 1024 * 1024) = 3,58 ... TB
3. Research
Here a similar problem is discussed and it is mentioned, that:
This problem occurs if you mapped a drive to a share that links to a mounted volume by using NTFS volume mount points or by using symbolic links.
RDM indeed uses symbolic links, however, no useful info is provided to remedy the problem.
4. Further details
The output of ls -al /DataVolume/
is:
total 28
drwxr-xr-x 4 root root 4096 Feb 2 06:05 .
drwxr-xr-x 25 root root 4096 Feb 2 12:06 ..
drwx------ 2 root root 16384 Feb 2 06:02 lost+found
drwxr-xr-x 5 root root 4096 Feb 2 06:05 shares
The output of du -sh /DataVolume/
is:
36K /DataVolume/
- Disk usage as reported by Windows 7 (same as
df -h
):
- Disk usage as reported by Ubuntu 17 Desktop (the used space is more accurate):
5. The question
Does someone know how to find what is consuming this space and causes the mismatch?
EDIT:
The question is indeed very similar to ext4 partition size / free space discrepancies. However, if I understand it correctly, the problem there is a smaller reported capacity of the drive. In my case there are 186 GB used in an empty drive. I would rather consider it related to the link I've provided, since the size of the used space is close to the size of the used space of the drive holding the simbolic link to the RDM.
tune2fs
) of the space is available to root only, so this is subtracted from the available space. IIRC, The space reported as used is used by internal filesystem metadata. NTFS has similar metadata, but instead of reporting it as used, it is simply subtracted from the total space. In that way, ext4 is being more "honest" than NTFS. – psusi Feb 04 '18 at 03:04