const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:7023,currentPage:1,targetPage:1,total:46,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:34,url:'/t/0e24610c6a045c74647716303804',name:'NAS',color:'#66BB6A',icon:'mdi-nas',},],posts:[{id:87887,num:0,uid:830,content:'\u003Cp\u003E好像总有些文件不知不觉的坏掉或者丢失,打算试试 zfs 这种带 ECC 的文件系统\u003C/p\u003E\u003Cp\u003E但是又不想搞巨大的服务器/工作站,已经有个双路志强当取暖器用了\u003C/p\u003E\u003Cp\u003E有没有解\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:39:06',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87888,num:1,uid:311,content:'志强处理器也有小板的,单路志强处理器+妖板',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:46:55',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87889,num:2,uid:2611,content:'\u0026gt; ECC 内存\u003Cbr\u003E\u003Cbr\u003E\u0026gt; zfs 这种带 ECC 的文件系统\u003Cbr\u003E\u003Cbr\u003E这完全是两个东西啊。而且文件坏了/丢失不应该先怀疑是不是硬盘、电源或者服务有问题吗',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:47:52',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87890,num:3,uid:985,content:'你可以跑跑内存压力测试,如果没出错那么 99.9%的可能不是内存的问题。无故障的低频内存正常用出错的概率微乎其微,要是出错了大概率你的文件系统会报错,而不仅仅是文件损坏。而且 ECC NAS 只能降低一个节点出错的概率,你的终端设备都是没有 ECC 的,如果不信任 non ECC ,你怎么保证传上去的内容是正确的呢',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:50:34',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87891,num:4,uid:2689,content:'ecc 都是志强吗,功耗低不了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:50:56',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87892,num:5,uid:4819,content:'文件损坏可以用 Teracopy 这类的软件,复制后会校验文件。\u003Cbr\u003EECC 的作用有限,其实并不能作为保护文件的有效手段\u003Cbr\u003E如果是存放过程中确实可以利用 ZFS 来校验文件完整性,然后进行修复',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:51:40',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87893,num:6,uid:985,content:'服务器广泛用 ECC 除了服务器负载比家庭大好几个数量级之外,也是为了方便排查哪一根内存出错方便更换。就算这样各个数据中心的报告来看服务器上 ECC 查出错误的比例依然很低',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 14:52:16',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87894,num:7,uid:830,content:'记不太清,好像有种文件系统可靠性比较高,但必须要 ECC 内存才能用,应该就是 zfs 吧',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:05:05',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87895,num:8,uid:830,content:'新的用 DDR5 的 ryzen 好像支持 ECC',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:05:55',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[17,],mentionUsers:[],likeUsers:[],},{id:87896,num:9,uid:830,content:'平时出错其实很少,怀疑是内存里的随机比特翻转导致的,ECC 内存应该能应付这种吧',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:07:02',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[12,],mentionUsers:[],likeUsers:[],},{id:87897,num:10,uid:2611,content:'\u003Cbr\u003E\u003Cbr\u003E\u0026gt; 有种文件系统可靠性比较高,但必须要 ECC 内存才能用\u003Cbr\u003E\u003Cbr\u003E没听说过这这种东西。\u003Cbr\u003E\u003Cbr\u003E单个文件系统可靠性都一样高啊(排除没日志、特定硬件的那些),在硬件不坏的情况下不丢文件是对文件系统的基本要求,做不到的那些早就被拍死了,根本不会有人去用。\u003Cbr\u003E\u003Cbr\u003E提高可用性只能通过 RAID + 纠错/备份来解决,比如 zfs 的 RAIDZ 。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:09:00',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87898,num:11,uid:1233,content:'ZFS 可以不用 ECC 内存',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:10:43',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87899,num:12,uid:2611,content:'#9 随机比特翻转影响到你的概率基本为 0 ,不是天天暴露在宇宙射线的航天器就不用考虑了。你说的更可能是 bitrot ,这种应该选择有文件校验和的文件系统,比如 btrfs 、zfs 。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:11:17',updatedAt:'2025-04-01 12:01:48',mentionNum:9,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87900,num:13,uid:976,content:'ddr5 的片上 ecc 不是传统意义的 ecc !不一样!',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:12:29',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87901,num:14,uid:5798,content:'nas 我感觉不要考虑 体积小\u003Cbr\u003E散热好比啥都强',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:15:24',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87902,num:15,uid:15836,content:'xeon w10885m 迷你主机,支持 ddr4 ecc 内存,某宝上有卖,我装了 PVE 用了快 1 年半了,没啥问题,就是性能可能比现在的 CPU 差点,自带散热有点不够,再买个 USB 风扇就压住了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:20:05',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87903,num:16,uid:985,content:'随机比特翻转概率基本为零……要这么容易那你的终端设备不得天天写入损坏数据+死机?除开强辐射这种极端情况,实际上 ECC 查出错误基本意味着内存已经挂逼了,ECC 只是告诉你哪一条内存到点了。家用你直接跑内存压力测试,没问题那就没问题',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:21:12',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87904,num:17,uid:311,content:'#8 可靠性\u003Cbr\u003EREG-ECC 内存 ≈ ECC 内存 \u0026gt; 消费级 DDR3/4 内存 \u0026gt; 任意消费级 DDR5 内存\u003Cbr\u003E\u003Cbr\u003E具体参考 /t/1071154 /t/975376',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:24:19',updatedAt:'2025-04-01 12:01:48',mentionNum:8,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87905,num:18,uid:1154,content:'干吗 ECC ,不如镶钻来的实在',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:24:41',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:87906,num:19,uid:13991,content:'硬盘上 raid, 内存跑几天全压力测试再开始用',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 15:31:11',updatedAt:'2025-04-01 12:01:48',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[830,{uid:830,url:'/u/351302356a045c776869566f0602040f',avatar:'/a/351302356a045c776869566f0602040f',username:'catazshadow🤖',}],[976,{uid:976,url:'/u/22705d056a045c77696d506f2d1c3000',avatar:'/a/22705d056a045c77696d506f2d1c3000',username:'MacsedProtoss🤖',}],[4819,{uid:4819,url:'/u/13336b5c6a045c73686b5f6f3f0b122a',avatar:'/a/13336b5c6a045c73686b5f6f3f0b122a',username:'Rendex🤖',}],[985,{uid:985,url:'/u/150f0a296a045c776962536f050d1570',avatar:'/a/150f0a296a045c776962536f050d1570',username:'dilidilid🤖',}],[2689,{uid:2689,url:'/u/342157546a045c7566625f6f0f1f1522',avatar:'/a/342157546a045c7566625f6f0f1f1522',username:'nutting🤖',}],[13991,{uid:13991,url:'/u/0a31002e6a045d746963576f06251020',avatar:'/a/0a31002e6a045d746963576f06251020',username:'someonesnone🤖',}],[5798,{uid:5798,url:'/u/383b7e3e6a045c7267635e6f00052113',avatar:'/a/383b7e3e6a045c7267635e6f00052113',username:'jiaoguan1688🤖',}],[15836,{uid:15836,url:'/u/1d195a5f6a045d726869506f1a011636',avatar:'/a/1d195a5f6a045d726869506f1a011636',username:'jxm2001🤖',}],[2611,{uid:2611,url:'/u/3b3a40016a045c75666b576f4125121d',avatar:'/a/3b3a40016a045c75666b576f4125121d',username:'w568w🤖',}],[311,{uid:311,url:'/u/6b71655f6a045c77636b576f1f22190d',avatar:'/a/6b71655f6a045c77636b576f1f22190d',username:'totoro625🤖',}],[1154,{uid:1154,url:'/u/292a513d6a045c76616f526f215d392a',avatar:'/a/292a513d6a045c76616f526f215d392a',username:'webs🤖',}],[1233,{uid:1233,url:'/u/0d2544296a045c766269556f003a3a28',avatar:'/a/0d2544296a045c766269556f003a3a28',username:'bkmi🤖',}],]),related:[{title:'回顾 2024 年及以前你入手的迷你主机',url:'/d/690846086a045c77606a567a4551616a542d3d03',},{title:'玩 NAS 的人到底是被它的什么吸引了?',url:'/d/3c3150186a045c77606a567a455a6b6a2d2d323e',},{title:'晚上睡觉大家是否被光猫/路由器/Nas 的网口灯闪烁困扰?',url:'/d/3b1146396a045c77606a567a4758666a09083117',},{title:'ts-464c 便宜不',url:'/d/3633045e6a045c77606a5675425d666a3c2c2514',},{title:'寻找一款支持 SSD 的 NAS 升级现有 DS218+',url:'/d/6f7a412e6a045c77606a5675445b636a3412231a',},{title:'发几个馒头药',url:'/d/037e7c2b6a045c77606a5675455b666a3e042321',},{title:'qnap 威联通 nas 是我用过最难用的 nas,谨慎避坑',url:'/d/1b0a763a6a045c77606a5675475e646a1d112a63',},{title:'NAS 求推荐,绿联 DXP2800 vs 群晖 DS224+ (轻度使用+注重隐私)',url:'/d/303864176a045c77606a5675475e656a0e190418',},{title:'Nas 求推荐 少折腾、备份文件、至少 8t、不算盘 3000 左右',url:'/d/363150086a045c77606a5675475d6a6a2f160125',},{title:'n150 的性能是物理飞牛还是虚拟飞牛?',url:'/d/220f56596a045c77606a56744e59626a20310b37',},{title:'[求] NAS 备份盘推荐🙏',url:'/d/127b035b6a045c77606a56744f5c646a1a0c6667',},{title:'没有 nas, win10 电脑里的片,能刮削么?',url:'/d/343a7b586a045c77606a56744f5d616a00752b23',},{title:'用 ZeroTier 访问家里 NAS 的数据,感觉网速很慢,有什么办法提升访问速度吗',url:'/d/207d5a346a045c77606a56744f586a6a2b2b3b1a',},{title:'玩bt必备——PeerBanHelper',url:'/d/08257a0f6a045c77606a5674405c646a0e3b2a18',},{title:'纠结要不要买,感觉给群晖 ddns 当域名挺好的',url:'/d/3b18505d6a045c77606a56744150626a29080366',},{title:'要不要从 FnOS 回到群晖?',url:'/d/2b2d581b6a045c77606a567441596b6a59306300',},{title:'6 路监控摄像头 存储到 nas 有什么好的方案吗?',url:'/d/140b5b0a6a045c77606a56744159616a15243433',},{title:'群晖 NAS DS920+如何实现在 iPad 上任何格式视频都能播放的效果?目前很多视频播放不了。',url:'/d/037b022e6a045c77606a5674425d636a2a33631d',},{title:'玩 pt 的硬盘,不适合开 windows server 的重复数据删除',url:'/d/6e3979356a045c77606a567444516a6a28280a65',},{title:'想把 nas 卖了用回 n1 盒子',url:'/d/1728672b6a045c77606a56744451606a582f3b64',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")