Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file-size-histogram #96

Open
farseerfc opened this issue Jun 11, 2020 · 30 comments
Open

file-size-histogram #96

farseerfc opened this issue Jun 11, 2020 · 30 comments

Comments

@farseerfc
Copy link
Owner

This issue is reserved for https://farseerfc.me/file-size-histogram.html

@Aloxaf
Copy link

Aloxaf commented Jun 12, 2020


1.46K……还有一堆 64~128B 的文件
我应该好好清理一下了……

@lilydjwg
Copy link

farseerfc 好棒~

我家刚好 4K 多一点呢:

myhome

然而根就只有 2K 了:

root

存了许多源码仓库、iso 镜像、视频文件的 xfs 才 1.6K:

xfs

缓存目录好多好小的文件啊:

cache

@farseerfc
Copy link
Owner Author

百合的系統裏有好多 32~64 的小文件呀,我這兒還沒這麼多……是 rust 編譯結果之類的麼

@lilydjwg
Copy link

lilydjwg commented Jun 12, 2020

啊对,那个地方有一堆 rust 的编译中间产物。还有 ccache 的缓存。

@sihuan
Copy link

sihuan commented Jun 12, 2020


1.38K 感觉在我家里面高峰过早的出现了
512~1G 的大概是存的番剧,大于 1G 的就是一些 .iso 了

@MatheMatrix
Copy link

我这里貌似是典型的 4K:

weiw myhome

@cuihaoleo
Copy link

我自己家目录是典型的4K。给两个特殊的。

USTC 镜像站可通过 rsync 访问的全部文件:
repo

我们实验室计算集群,所有用户家目录的文件(除了程序和各种程序生成的文件,大部分是图片音频数据):
public

@farseerfc
Copy link
Owner Author

farseerfc commented Jun 25, 2020 via email

@yichangshengwu
Copy link

说明系统文件又碎又多!!! (逃跑

@Hexhu
Copy link

Hexhu commented Jul 13, 2020

我的家目录:
my-home-file-size-histogram

一堆源码, 音乐和漫画 :3

@yingziwu
Copy link

yingziwu commented Aug 5, 2020

根目录下的结果:
root

家目录下的结果,这应该是缓存文件比较多
home

@poscat0x04
Copy link

poscat0x04 commented Aug 19, 2020

root
symlinks
the total file size tho...

@farseerfc
Copy link
Owner Author

root
symlinks
the total file size tho...

是把 /proc/kcore 算進去了嗎,還有這麼多 0 大小的… find 可以 -xdev

@yingziwu
Copy link

@farseerfc

root
symlinks
the total file size tho...

是把 /proc/kcore 算進去了嗎,還有這麼多 0 大小的… find 可以 -xdev

应该是把 /proc 算进去了。
感觉博文中的find命令可以更新一下:

find / -type f -not -path '/tmp/*' -not -path '/sys/*' -not -path '/dev/*' -not -path '/proc/*' -not -path '/run/*' -not -path '/media/*' -not -path '*/lost+found/*' -printf "%s %p\n" > /tmp/root.txt

@noirgif
Copy link

noirgif commented Aug 21, 2020

很有趣的文章!

这么一说好像的确是这样。我碰巧课上读过统计文件系统 trace 的论文,和这里的不同之处是,统计的不是某一时刻已有的文件大小,而是给定时间内创建的文件的大小。 Mary Baker 等的 Measurements of a Distributed File System 里的 CDF 就有这个现象:不同的 trace,文件大小中位数在 1K - 10K 不等,众数在 500B 。99年的 File system usage in Windows NT 4.0 里,中位数也是 1K 到 10K 这个量级(根据用途,read-only/read-write/write-only,各不相同)。

中位数和众数较小也是因为统计的对象不同?不过只是我的猜测。

不过在 NT 那篇里,如果按照读写的字节数给文件大小加权的话,绝大部分读写就落在了10K-1M这个区间。(现在可能会更大?但是我不知道有没有相关的研究,如果有我很乐意去看。)就是文中也有提到的长尾吧。

@poscat0x04
Copy link

root
symlinks
the total file size tho...

是把 /proc/kcore 算進去了嗎,還有這麼多 0 大小的… find 可以 -xdev

应该都是 nix 产生的 symlink (传统艺能)

@mokurin000
Copy link

图片
我的学习资料……

@nicholascw
Copy link

图片

@forliuyifei
Copy link

$ ./filesizehistogram.py myhome.txt
Traceback (most recent call last):
  File "./filesizehistogram.py", line 38, in <module>
    data=np.array([int(x.split(' ')[0]) for fn in filenames for x in open(fn)])
  File "./filesizehistogram.py", line 38, in <listcomp>
    data=np.array([int(x.split(' ')[0]) for fn in filenames for x in open(fn)])
ValueError: invalid literal for int() with base 10: '请输入密码\n'

@farseerfc
Copy link
Owner Author

$ ./filesizehistogram.py myhome.txt
Traceback (most recent call last):
  File "./filesizehistogram.py", line 38, in <module>
    data=np.array([int(x.split(' ')[0]) for fn in filenames for x in open(fn)])
  File "./filesizehistogram.py", line 38, in <listcomp>
    data=np.array([int(x.split(' ')[0]) for fn in filenames for x in open(fn)])
ValueError: invalid literal for int() with base 10: '请输入密码\n'

你看下 myhome.txt 的內容,感覺不太對吶,“請輸入密碼”是啥。
正常應該是每行一個數字和文件名,空格隔開,文件名可選。

@forliuyifei
Copy link

$ ./filesizehistogram.py myhome.txt
Traceback (most recent call last):
  File "./filesizehistogram.py", line 38, in <module>
    data=np.array([int(x.split(' ')[0]) for fn in filenames for x in open(fn)])
  File "./filesizehistogram.py", line 38, in <listcomp>
    data=np.array([int(x.split(' ')[0]) for fn in filenames for x in open(fn)])
ValueError: invalid literal for int() with base 10: '请输入密码\n'

你看下 myhome.txt 的內容,感覺不太對吶,“請輸入密碼”是啥。
正常應該是每行一個數字和文件名,空格隔開,文件名可選。

明白了,因为有个目录需要 root 权限,所以 find 之前加了 sudo ,myhome.txt 第一行多出了:“请输入密码” 🤣

@forliuyifei
Copy link

forliuyifei commented Apr 3, 2021

image
/home 目录, 我这里是 2k ?
或许是因为放了一些 git 仓库?

@WhiredPlanck
Copy link

Figure_1.png

学生党的 /home,有数不清的课件、截图、慕课啥啥啥,还有一些 git 源码 …… QwQ

@soda92
Copy link

soda92 commented Jun 10, 2021

图片

@sgkoishi
Copy link

sgkoishi commented Jul 4, 2021

files
一只Windows上的文件
没有太多头绪为什么会有这些奇怪的突起.jpg

@h3fang
Copy link

h3fang commented Jul 6, 2021

去掉了/proc, /sys这些

sudo find / /home -xdev -type f -printf "%s\n" > data.txt

file_size

@liyewen521
Copy link

哈哈,差不多也符合统计值4K了,就是均值有一点大,达到了1.68M,可能因为我生成的大的log文件比较多。
image

@SamLukeYes
Copy link

nix-store
扫了一下我的 /nix/store,好像把硬链接全都重复算了,实际占用只有不到 50G

@Sinofine
Copy link

图片
emm 硬连接?我的硬盘加起来也只有1.5T喵

@illyber
Copy link

illyber commented Nov 19, 2023

涨知识了。很有趣的研究

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests