4
1
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
/dev/sdb1
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:
[usbdisk2]
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):
#!/bin/sh
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
Thanks,
1Note 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 runningsudo 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 – 2013-03-31T14:53:55.937