I've just bought a WD elements 3TB external hard drive, formatted it to ext4 and mounted it on raspberry pi (raspbian (fork of debian) with latest kernel and package updates), and I've a problem linux counting its free space.

This is the fdisk -l output:

Disk /dev/sdb: 3000.6 GB, 3000590401536 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566016 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0018b22e

   Device Boot      Start         End      Blocks   Id  System

         256   732566015  2930263040   83  Linux

This is the df -h output of the drive:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       2.7T  201M  2.6T   1% /media/disk2

I've mounted it on samba (smb.conf) like this:

comment = password please!
dfree command = /home/pi/dfree    
path = /media/disk2
create mask = 0775
directory mask = 0775
read only = no
guest ok = yes
browseable = yes
writable = yes

This is my /home/pi/dfree (777 chmodded):

df $1 | tail -1 | awk '{print $2" "$4}'

This is my samba version: Samba version 3.6.6

When the network drive is mounted on windows, even if there are no files on drive, it says 139GB used space, which is not acceptable for me.

What am I doing wrong, how do I fix this?

Edit: I've also provided a dfree method, issue goes on. Updating the question


1 Answer 1


OK, solved it, seems like it's the file system's reserve. This post on Ubuntu Help Center helped me.

It seems ext4 reserves 5% of the disk space to super user (root) so that if the file system is full, some critic stuff can still be written on the disk. If this is a storage drive like mine, you don't need that space unless extreme situations.

So before mounting, I simply did this:

pi@raspberrypi ~ $ sudo tune2fs -m 0.1 /dev/sdb1
tune2fs 1.42.5 (29-Jul-2012)
Setting reserved blocks percentage to 0.1% (732565 blocks)

So it dropped 5% of usage to 0.1% (you can also put 0% , I just wanted to leave something)

And after reboot, it's now shown okay.

  • 1
    Note that tune2fs also supports the -r command-line option which allows to specify the amount of space to reserve in blocks (typically a block is 4096 bytes (4KiB) but you can know for sure by running sudo tune2fs -l /dev/sdb1|grep 'Block size'). So I usually do something like this after creating a filesystem: tune2fs -r $((100*1024*1024/4096)) /dev/sdb1 which means reserving 100MiB for root.
    – kostix
    Mar 31, 2013 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.