farseerfc / farseerfc.github.io

My new blog style with bootstrap-material-design
17 stars 6 forks source link

file-size-histogram #96

Open farseerfc opened 4 years ago

farseerfc commented 4 years ago

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

Aloxaf commented 4 years ago

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

lilydjwg commented 4 years ago

farseerfc 好棒~

我家刚好 4K 多一点呢:

myhome

然而根就只有 2K 了:

root

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

xfs

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

cache

farseerfc commented 4 years ago

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

lilydjwg commented 4 years ago

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

sihuan commented 4 years ago

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

MatheMatrix commented 4 years ago

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

weiw myhome

cuihaoleo commented 4 years ago

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

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

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

farseerfc commented 4 years ago

2020年6月25日(木) 6:33 CUI Hao notifications@github.com:

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

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

哇 USTC mirror 有 50T 的數據量了!

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

有好多 1~32 的呢,看來畫圖的時候合併 1~32 的數據在一組也不是很合適,破壞曲線形狀了。

--


大阪大学国際公共政策研究科 楊 嘉晨 (YANG Jiachen) 〒560-0043豊中市待兼山町1-7 E-mail: yang@osipp.osaka-u.ac.jp TEL:080-3853-2770

yichangshengwu commented 4 years ago

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

Hexhu commented 4 years ago

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

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

yingziwu commented 3 years ago

根目录下的结果: root

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

poscat0x04 commented 3 years ago

root symlinks the total file size tho...

farseerfc commented 3 years ago

root symlinks the total file size tho...

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

yingziwu commented 3 years ago

@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 commented 3 years ago

很有趣的文章!

这么一说好像的确是这样。我碰巧课上读过统计文件系统 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 commented 3 years ago

root symlinks the total file size tho...

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

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

mokurin000 commented 3 years ago

图片 我的学习资料……

nicholascw commented 3 years ago

图片

forliuyifei commented 3 years ago
$ ./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 commented 3 years ago
$ ./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 commented 3 years ago
$ ./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 commented 3 years ago

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

WhiredPlanck commented 3 years ago

Figure_1.png

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

soda92 commented 3 years ago

图片

sgkoishi commented 3 years ago

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

h3fang commented 3 years ago

去掉了/proc, /sys这些

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

file_size

liyewen521 commented 2 years ago

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

SamLukeYes commented 1 year ago

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

Sinofine commented 1 year ago

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

illyber commented 8 months ago

涨知识了。很有趣的研究