simple-torrent icon indicating copy to clipboard operation
simple-torrent copied to clipboard

Free disk space is incorrect while running on docker in macOS

Open marcograss opened this issue 6 years ago • 4 comments

Issue description

I am running simple torrent on macOS with docker. Simple torrent web UI shows I have 19.4 Terabytes of free disk space, in reality I have only few Gigabytes.

image

By running the df command inside the container, it also shows the correct free disk space.

Filesystem           1K-blocks      Used Available Use% Mounted on
overlay               65792556  10135000  52285780  16% /
tmpfs                    65536         0     65536   0% /dev
tmpfs                  2021240         0   2021240   0% /sys/fs/cgroup
shm                      65536         0     65536   0% /dev/shm
osxfs                487712924 413744756  70123524  86% /torrents
osxfs                487712924 413744756  70123524  86% /downloads
/dev/sda1             65792556  10135000  52285780  16% /etc/resolv.conf
/dev/sda1             65792556  10135000  52285780  16% /etc/hostname
/dev/sda1             65792556  10135000  52285780  16% /etc/hosts
tmpfs                  2021240         0   2021240   0% /proc/acpi
tmpfs                    65536         0     65536   0% /proc/kcore
tmpfs                    65536         0     65536   0% /proc/keys
tmpfs                    65536         0     65536   0% /proc/timer_list
tmpfs                    65536         0     65536   0% /proc/sched_debug
tmpfs                  2021240         0   2021240   0% /sys/firmware

Steps to reproduce the issue

simple-torrent version: latest on docker pull (version 1.0.17 - Go 1.13) macOS version: 10.14.6 docker desktop version: 2.1.0.2

What's the expected result?

The correct Free disk space is shown.

What's the actual result?

A wrong (huge) amount of free disk space is display.

image

marcograss avatar Sep 14 '19 08:09 marcograss

The data was read from github.com/shirou/gopsutil library, I believe there's bug in calculating the total disk size. While looking into it I find simpler way by just reading the free attribute, instead of calculating it in javascript, try out the latest docker image.

boypt avatar Sep 16 '19 02:09 boypt

I just updated to the latest

docker pull boypt/cloud-torrent  
Using default tag: latest
latest: Pulling from boypt/cloud-torrent
9d48c3bd43c5: Already exists 
3e1b18d30634: Pull complete 
Digest: sha256:77341b5103b4476f707b3b265e1495da923bf670595297421b802fce72f550d0
Status: Downloaded newer image for boypt/cloud-torrent:latest
docker.io/boypt/cloud-torrent:latest

Seems no luck, it still show Terabytes of free space.

marcograss avatar Sep 16 '19 05:09 marcograss

It's seems like a unix platform compatible problem and we are not alone, many other projects have same issues.

  • https://github.com/goharbor/harbor/pull/5695
  • https://github.com/docker/for-mac/issues/2136

I patched to gopsutils package but I don't have a macos to verify, try pull the latest again (Digest: sha256:1b5c79df206b168631956e7bde208d55c1e07a8bb2966996fdf94ffc601c6baa) , If it's ok, I will PR the patch to upstream.

boypt avatar Sep 16 '19 06:09 boypt

No visible changes, I might try then to see if I can fix it myself in the future, since I have the environment to test

marcograss avatar Sep 16 '19 07:09 marcograss