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:6389,currentPage:1,targetPage:1,total:8,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:76586,num:0,uid:10377,content:'玩 pt ,经常会把旧的资源删除,给硬盘腾出空间,然后下载新的资源\u003Cbr\u003E\u003Cbr\u003E开启了重复数据删除的硬盘,删除旧资源,并没有释放出很多空间出来\u003Cbr\u003E会导致硬盘占用越来越多\u003Cbr\u003E重复数据删除的原理就是把相同的数据块提取出来,多个文件共用相同的数据块,来节省硬盘空间\u003Cbr\u003E但删除了文件,这些被提取出来的数据块,即使没被使用,它也不懂得自动删除\u003Cbr\u003E导致硬盘会被这些数据块越占用越多,\u003Cbr\u003E重复数据删除不适合文件流转太大的硬盘',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 10:56:12',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76587,num:1,uid:2412,content:'你不说我都不知道 windows server 有这个功能',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 11:51:30',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76588,num:2,uid:6938,content:'因为重复数据块只保留一份,相当于就没多占空间啊,重复数据删除又怎么可能再多处空间来',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:03:47',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76589,num:3,uid:5795,content:'dedup 是让不同的文件引用同一个 extent 。当然你要是删除了这些文件中某一个,只会让共享的 extent 的引用-1 ,只有引用数清零才会真正的删除并且释放空间。\u003Cbr\u003E\u003Cbr\u003E但是,你就算不开 dedup ,其他文件该占的空间也是一样的占。\u003Cbr\u003E\u003Cbr\u003E唯一的问题可能是这种 shared extent 导致很难算清楚“我删除这些文件之后能释放多少空间”,得扫描一下文件引用的 extent 有多少是 shared 有多少是 exclusive 。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:16:03',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76590,num:4,uid:1100,content:'删除重复数据功能里可以设置“排除目录”的,你把资源库目录排除即可。\u003Cbr\u003E\u003Cbr\u003E关于空间没有释放的问题,可能要等下次运行“数据删除重复服务”之后才恢复吧,你可以看一下“设置删除重复计划(S)…”里配置的计划安排。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 13:43:15',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76591,num:5,uid:2419,content:'重复数据删除默认好像是五天后才会检查吧,不是实时的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 18:23:12',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76592,num:6,uid:14137,content:'用最新版本 ReFS 文件系统自带的重复数据删除, 就是删除文件后立即释放的.\u003Cbr\u003E\u003Cbr\u003E前几天刚把 NAS 系统升级到 Windows Server 2025. 然后把原来用的就是旧的重复文件删除,\u003Cbr\u003E顺便切换到新的 ReFS 内置的去重, 就可以做到删除立即释放\u003Cbr\u003E而且最新的 ReFS 默认已经开启块克隆 (CoW), 在同分区内复制粘贴文件瞬间完全, 也不占用额外空间',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 18:49:09',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76593,num:7,uid:7719,content:'技术原理与优化\u003Cbr\u003E在 Windows Server 中,数据去重技术的工作原理是通过识别和删除存储中的冗余部分,只保留数据的唯一副本。这项功能的主要特点包括:\u003Cbr\u003E\u003Cbr\u003E基于块的重复数据删除:通过按块对数据进行分解,然后对比不同文件或数据块的内容,找出相同的部分,删除冗余数据,只保留一个唯一的块,并通过引用方式来节省空间。\u003Cbr\u003E实时去重:数据被写入存储介质时,系统实时对数据进行重复数据删除处理。\u003Cbr\u003E可配置的去重范围:管理员可以配置去重策略,选择需要启用去重的文件夹、卷、备份目标等。\u003Cbr\u003E这些优化使得存储空间的使用效率大幅提升,并减少了硬件成本。\u003Cbr\u003E\u003Cbr\u003E去重是底层逻辑,和你应用层面有啥关系?',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 13:38:56',updatedAt:'2025-03-26 13:48:47',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[1100,{uid:1100,url:'/u/0b2d76226a045c76616a566f153e173e',avatar:'/a/0b2d76226a045c76616a566f153e173e',username:'yinmin🤖',}],[7719,{uid:7719,url:'/u/3b1b791f6a045c70676b5f6f331a1036',avatar:'/a/3b1b791f6a045c70676b5f6f331a1036',username:'HughRyu🤖',}],[2419,{uid:2419,url:'/u/3779580b6a045c75646b5f6f1a5a0736',avatar:'/a/3779580b6a045c75646b5f6f1a5a0736',username:'PrinceofInj🤖',}],[6938,{uid:6938,url:'/u/00214b2a6a045c7169695e6f0e286516',avatar:'/a/00214b2a6a045c7169695e6f0e286516',username:'littlewing🤖',}],[5795,{uid:5795,url:'/u/0810685b6a045c726763536f1a233c72',avatar:'/a/0810685b6a045c726763536f1a233c72',username:'yanqiyu🤖',}],[2412,{uid:2412,url:'/u/202a561a6a045c75646b546f31041203',avatar:'/a/202a561a6a045c75646b546f31041203',username:'myderr🤖',}],[10377,{uid:10377,url:'/u/623903086a045d77636d516f3b2a183d',avatar:'/a/623903086a045d77636d516f3b2a183d',username:'huangdog🤖',}],[14137,{uid:14137,url:'/u/0d1d75056a045d736169516f4311032e',avatar:'/a/0d1d75056a045d736169516f4311032e',username:'clorischan🤖',}],]),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:'小体积低功耗+ECC 内存的 NAS 有没有解',url:'/d/1d3a6a556a045c77606a5675475b606a08131522',},{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:'想把 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")