2

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):

enter image description here

  • Disk usage as reported by Ubuntu 17 Desktop (the used space is more accurate):

enter image description here

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.

scopchanov
  • 121
  • 6
  • @psusi, thanks for the link! 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 relate the cause 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. In any case I would be glad if you could give me ideas how to approach the problem from this point on. – scopchanov Feb 02 '18 at 20:24
  • @psusi, nope, I am not right. It is not related to the symbolic link. I've changed the filesystem from ext4 to ntfs and reclaimed the space. Now an empty drive is shown as an empty drive. I've upvoted your anser from the link. Thanks a million for pointin my attention to that! – scopchanov Feb 02 '18 at 21:00
  • It's mostly just the way that ext4 reports the statistics. NTFS has about the same overhead; it just reports differently. – psusi Feb 04 '18 at 01:15
  • @psusi, do I understand it correctly: the space is available, just ext4 reports it as used and with root privileges I would be allowed to write to the disk (which doesn't contain system files, just data) when I reach the max capacity minus the used space (186 GB in this case)? – scopchanov Feb 04 '18 at 02:32
  • 1
    5% ( adjustable with 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

0 Answers0