一直在用威联通的qnap作为主为的存储工具,某天偶然在油管上看到Linus的装机视频,用的是叫一个unraid的nas系统,介绍说是比raid5安全,可以容忍1~2块盘出错,还可以设置cache,虚拟机使用KVM+virto,于是在心中默默地种了草。
经过两周左右的倒腾,把原来买的散片i38100和丐板H110组了一套Unraid系统的nas。由于unraid上没有快照备份功能,之前用的seafile数据库和数据文件容易出现unsync的情况,想了下,搭了个nextcloud+onlyoffice,基本功能都涵盖了(感觉这学习成本不小,各位看官慎重学我)。
今天在迁移视频数据遇到一个问题,发现在迁移过程中cache满了,安装的虚拟机也随即自动停止了,甚是怪异。看了下日志,一直提示:
tower shfs: cache disk full
我把虚拟机所在的共享文件夹和视频数据所在的共享文件夹缓存策略都设为了"Prefer"。按照我开始的理解,cache满了,再操作Move,就应该把数据全移到磁盘中啊?其实不然。
仔细来看下Unraid中的缓存策略吧。
Specify whether new files and directories written on the share can be written onto the Cache disk/pool if present.
This setting also affects mover behavior.
`No` prohibits new files and subdirectories from being written onto the Cache disk/pool.
Mover will take no action so any existing files for this share that are on the cache are left there.
`Yes` indicates that all new files and subdirectories should be written to the Cache disk/pool, provided enough free space exists on the Cache disk/pool.
If there is insufficient space on the Cache disk/pool, then new files and directories are created on the array.
When the mover is invoked, files and subdirectories are transferred off the Cache disk/pool and onto the array.
`Only` indicates that all new files and subdirectories must be writen to the Cache disk/pool.
If there is insufficient free space on the Cache disk/pool, create operations will fail with out of space status.
Mover will take no action so any existing files for this share that are on the array are left there.
`Prefer` indicates that all new files and subdirectories should be written to the Cache disk/pool, provided enough free space exists on the Cache disk/pool.
If there is insufficient space on the Cache disk/pool, then new files and directories are created on the array.
When the mover is invoked, files and subdirectories are transferred off the array and onto the Cache disk/pool.
NOTE: Mover will never move any files that are currently in use.
总的来说,这些策略都是对新的文件和文件夹生效的。具体的不同在于我们在执行Move动作时,数据放在哪里。
No:
新的数据不会缓存,但如果有老的数据在cache中,Move后对老数据不会有任何变化。
Yes:
新的数据会缓存,同时执行Move后,所有数据都会移入磁盘阵列。
Only:
新的数据只会在缓存中,Move后新老数据没有动作。
Prefer:
按字面理解就是倾向于。这种策略会将新的数据缓存,执行Move后,甚至会将原来存放在磁盘阵列中的数往cache中搬,直到cache满为止。
所以,问题就很清楚了。我一开始将视频文件的缓存策略设置成了Prefer。当cache满后,虚拟机就会停止,同时即便再执行Move也不会“释放”更多缓存。