首页 > 代码库 > 快照的快照删除:cannot delete dir - Directory not empty
快照的快照删除:cannot delete dir - Directory not empty
事件概要:第一次测试创建快照的快照后,想要把其删除快照。但失败,失败提示如下:
[root@mylinux ~]# btrfs subvolume delete /mydata/logs_snapshot Delete subvolume (no-commit): ‘/mydata/logs_snapshot‘ ERROR: cannot delete ‘/mydata/logs_snapshot‘ - Directory not empty
一步步跟着老师的脚步操作,怎么我的就失败了呢,各种纠结,下面是问题处理过程命令:
[root@mylinux ~]# btrfs subvolume delete /mydata/logs_snapshot/ Delete subvolume (no-commit): ‘/mydata/logs_snapshot‘ ERROR: cannot delete ‘/mydata/logs_snapshot‘ - Directory not empty You have new mail in /var/spool/mail/root #查看文件夹快照logs_snapshot里面内容 [root@mylinux ~]# ls /mydata/logs_snapshot grub2.cfg logs #尝试删除快照文件夹里的文件,但目录不可这样删除,需要加-rf参数 [root@mylinux ~]# rm /mydata/logs_snapshot/* rm: remove regular file ‘/mydata/logs_snapshot/grub2.cfg’? y rm: cannot remove ‘/mydata/logs_snapshot/logs’: Is a directory [root@mylinux ~]# ll -a /mydata/logs_snapshot total 16 drwxr-xr-x. 1 root root 8 Oct 5 17:05 . drwxr-xr-x. 1 root root 90 Oct 5 17:03 .. drwxr-xr-x. 1 root root 18 Oct 5 16:51 logs [root@mylinux mydata]# rm -rf logs_snapshot #加上-rf参数尝试删除文件夹logs但失败了 rm: cannot remove ‘logs_snapshot/logs’: Operation not permitted [root@mylinux mydata]# chmod 777 logs_snapshot #对该文件授权 [root@mylinux mydata]# ll total 24 -rw-r--r--. 1 root root 0 Oct 5 12:47 a.txt drwxr-xr-x. 1 root root 0 Oct 5 16:18 cache -rw-r--r--. 1 root root 13948 Oct 5 13:03 functions -rw-r--r--. 1 root root 5137 Oct 5 12:47 grub2.cfg drwxr-xr-x. 1 root root 18 Oct 5 16:59 logs drwxrwxrwx. 1 root root 8 Oct 5 17:05 logs_snapshot [root@mylinux mydata]# rm -rf logs_snapshot #仍然无法删除 rm: cannot remove ‘logs_snapshot/logs’: Operation not permitted #就这样折腾了好长一段时间,网上资料也找过尝试过但无果,这时候脑海里出现,为何不先查看快照列表 [root@mylinux logs_snapshot]# btrfs subvolume list /mydata ID 266 gen 104 top level 5 path cache ID 267 gen 122 top level 5 path logs ID 270 gen 128 top level 5 path logs_snapshot ID 271 gen 126 top level 270 path logs_snapshot/logs #这就是病根 #快照的快照需要先删除最里层的,方可删除外面的快照。 [root@mylinux logs_snapshot]# btrfs subvolume delete /mydata/logs_snapshot/logs Delete subvolume (no-commit): ‘/mydata/logs_snapshot/logs‘ [root@mylinux logs_snapshot]# ls [root@mylinux logs_snapshot]# cd .. [root@mylinux mydata]# btrfs subvolume delete /mydata/logs_snapshot Delete subvolume (no-commit): ‘/mydata/logs_snapshot‘ [root@mylinux mydata]# btrfs subvolume list /mydata ID 266 gen 104 top level 5 path cache ID 267 gen 122 top level 5 path logs
本文出自 “扬帆起航” 博客,请务必保留此出处http://mystery888.blog.51cto.com/9560453/1858874
快照的快照删除:cannot delete dir - Directory not empty
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。