tuna各位技术大牛们,我是自动化一名小硕,平时较少用linux。今天在组里服务器跑程序时inodes满了,于是Google了一下,按照这个博客的操作http://blog.gdsyzx.edu.cn/sense/?p=2329,现在服务器上好像什么都没有了,求问这种情况我的数据还有救吗?具体怎么恢复你?

Best Regards,
Chen 




发件人:Justin Wong <[email protected]>
发送时间:2016-05-04 10:10
主题:[tuna-general] Re: [USTC-LUG] 一种减轻 mirrors rsync 副作用的思路
收件人:"Ray Song"<[email protected]>
抄送:"tuna-general"<[email protected]>,"ustc_lug"<[email protected]>

应该是这个逻辑,其实可以把limit_in_bytes放宽松一些,rsync 本身占不了多少内存,但是对cache的消耗非常大。 

-- 
Justin Wong 

On Wed, May 4, 2016, at 00:58, Ray Song wrote: 
> 似乎是因为 memory.limit_in_bytes 限制物理内存 
> 在应用程序申请的内存和 buffer cache 总和超过限制的情况下,会把超出的弄到 swap 
> buffer cache就直接丢弃了? 
>  
>  
>  
> On 2016-05-04, Justin Wong wrote: 
> >以前在 ustc 邮件列表看到过 mirrors 磁盘缓存几乎无效的问题,其中一个主要原因是 rsync 一遍就扫一遍磁盘,cache 全废了。 
> > 
> >今天看到一个叫 nocache 的工具 https://github.com/Feh/nocache 可以禁止某个进程使用 
> >cache,进而发现除了 nocache 还有一些方案可以考虑。 
> > 
> >一个是最暴力的方式是直接使用 cgroup 限制 rsync 的内存。我测了一下,效果拔群 
> > 
> >``` 
> >cgcreate -g memory:cptest 
> >cgset -r memory.limit_in_bytes=20M cptest  # 创建个 cgroup 并限制内存使用为 20MB 
> >dd if=/dev/zero of=test bs=1M count=2048   # 创建个2G的文件 
> >echo 3 > /proc/sys/vm/drop_caches              # 把已有的 cache drop 掉,这时 
> >free -m 应该看见 cache 的量很小了 
> > 
> >cgexec -g memory:cptest cp test test 1         # 在 cgroup 中复制一遍 test 
> >/nocache/cachestats ./test1                            # 用 nocache 
> >提供的工具看一下 cache 情况,几乎没有被任何 cache 
> >> pages in cache: 1175/524288 (0.2%)  [filesize=2097152.0K, pagesize=4K] 
> > 
> ># 然后直接跑 cp,再用 cachestats 看一下 
> >cp test test1 
> >nocache/cachestats ./test1 
> >> pages in cache: 524288/524288 (100.0%)  [filesize=2097152.0K, pagesize=4K] 
> ># 全被 cache 住了 
> >``` 
> > 
> >还有就是 http://insights.oetiker.ch/linux/fadvise.html 这个地方提供了一个 rsync 的 
> >patch,使用 fadvice 让 rsync 尽量不使用 cache。 
> > 
> >感觉解决了一个老大难问题啊。 
> > 
> >-- 
> >Justin Wong 
> > 
> >--  
> >来自USTC LUG 
> >请使用gmail订阅,不要灌水。 
> >更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en 
> >--- 
> >You received this message because you are subscribed to the Google Groups 
> >"USTC_LUG" group. 
> >To unsubscribe from this group and stop receiving emails from it, send an 
> >email to [email protected]. 
> >For more options, visit https://groups.google.com/d/optout. 
>  
> --  
> Ray 
> http://maskray.me 

--  

---  
You received this message because you are subscribed to the Google Groups "TUNA 
主邮件列表" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected]. 
To post to this group, send email to [email protected]. 
For more options, visit https://groups.google.com/d/optout. 

-- 

--- 
You received this message because you are subscribed to the Google Groups "TUNA 
主邮件列表" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

回复