求助rm:rm 无法删除目录"/run/user/root/gvfs":是一个目录 问题

吟咏调 - 歌单 - 网易云音乐
播放:177次
网易云音乐多端下载
同步歌单,随时畅听320k好音乐
网易公司版权所有(C)杭州乐读科技有限公司运营:
违法和不良信息举报电话:6
举报邮箱:linux root用户下要删除一个文件却删除不了。_百度知道
linux root用户下要删除一个文件却删除不了。
ls -l后显示dr-x-w-r-T
4743 Oct 17
2005 memsize请问要怎么删除
我有更好的答案
首先确认要删除的是什么文件,在Linux命令行界面下,所有的设备、文件、挂载等都显示类似于文件,确认不要删除错了。如果确认是一个可删除的文件但是无法删除,那么可能是文件损坏,或者是一个无效的挂载文件都可能造成无法删除的情况,解决方法可以通过重启Linux系统,在重启时,如果是文件系统有问题,Linux会提示修复,按照界面的提示修复即可,如果是无效挂载造成的,重启之后应该即可解决。
采纳率:50%
看T 可以知道memesize文件有特殊权限删除方法1. chmod o-T memsize
去掉特殊权限2. rm -f memsize你可以搜索linux 文件特殊权限
这个是目录吧?具备T权限,应该是个保存临时文件的目录,删除目录需要参数: -r
运行chown -R root.root memsize
##改变该文件的属组和属主这个是因为文件的属主和属组不是root还有,你这个文件权限前边是d,目测应该是一个目录应该执行rm -rf
正常来说,你直接可以用 rm -fr memsize 就可以删除啊
进入root用户后不要在在要删除的目录下
最好在根下 查看有没有这个文件的使用 或者挂载等,一切都确定好了执行rm -rf 加上删除的文件路径
其他4条回答
为您推荐:
其他类似问题
linux的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。ROS知识1-初级教程之常见问题汇总-ROS机器人俱乐部 | 更多交流、更多资料,社区为开发者带来便利
ROS知识1-初级教程之常见问题汇总
ROS知识1-初级教程之常见问题汇总
发布时间:日 17:05:20 &&
浏览数:1374次 &&
一、开机启动ROS的工作空间的路径设置失败现象:在教程http://wiki.ros.org/cn/ROS/Tutorials/CreatingPackage中的第5.1小节,运行以下命令失败:$ rospack depends1 beginner_tutorials提示错误:
Error: package
一、开机启动ROS的工作空间的路径设置失败现象:在教程http://wiki.ros.org/cn/ROS/Tutorials/CreatingPackage中的第5.1小节,运行以下命令失败:$ rospack depends1 beginner_tutorials提示错误: [rospack] Error: package 'beginner_tutorials' not found原因:是因为创建Catkin的Source时失败了,导致catkin工作空间的根路径查找不到。这是由于设置4小节中的工作空间Source失败,可以手动source$ source devel/setup.bash不知道什么原因,只能动手动进行修改了。解决办法:ubuntu 下面情况处理echo "source /opt/ros/idigo/setup.bash" && ~/.bashrc
echo "source ~/catkin_ws/devel/setup.bash" && ~/.bashrc
source ~/.bashrc注意直接编辑 ~/.bashrc添加相应的bash文件,再source&~/.bashrc也是不可以的。二、.gvfs&错误问题:输入rosrun 然后敲击Tab不全,出现如下的错误信息:rosrun [rospack] Warning: error while crawling /home/useraccount: boost::filesystem::status: Permission denied: "/home/useraccount/.gvfs"&(这里的useraccount对应您具体的电脑用户名)解决办法:sudo umount /home/useraccount/.gvfs
(这里的useraccount对应您具体的电脑用户名)
rm -rf .gvfs/文章转自:我需要买851.8吗【单反吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:1,589,893贴子:
我需要买851.8吗收藏
机身6d,用不惯变焦,也不爱拍风景,已经有了小痰盂,我还需要买851.8吗?
苏宁企业购,办公用品设备,优惠购,正品低价,品质保障,优质服务!大单采购更优惠!苏宁企业采购 一站式本地化采购服务平台!
85 1.4,多买几个普通货色,不如一个极品在手
喜欢就买啊
登录百度帐号Linux恢复误删除的文件或者目录 - 简书
Linux恢复误删除的文件或者目录
2017 年 2 月 1 日 GitLab 数据库被误删引起了.
linux不像windows有个回收站,使用rm -rf *基本上文件是找不回来的。
那么问题来了:
对于linux下误删的文件,我们是否真的无法通过软件进行恢复呢?
答案当然是否定的,对于误删的文件,我们还是能通过软件恢复过来的。对于误删文件还原可以分为两种情况:
一种是删除以后在进程存在删除信息
一种是删除以后进程都找不到,只有借助于工具还原。
接下来以例子分别解说下两种不同的误删还原方式:
误删除文件进程还在的情况:
这种一般是有活动的进程存在持续标准输入或输出,到时文件被删除后,进程PID依旧存在。这也是有些服务器删除一些文件但是磁盘不释放的原因。
打开一个终端对一个测试文件做cat追加操作:
[root@docking ~]# echo "This is DeleteFile test." & deletefile.txt
[root@docking ~]# ls
deletefile.txt
[root@docking ~]# cat && deletefile.txt
Add SomeLine into deletefile for fun.
打开另外一个终端查看这个文件可以清楚看到内容:
[root@docking ~]# ls
deletefile.txt
[root@docking ~]# cat deletefile.txt
This is DeleteFile test.
Add SomeLine into deletefile for fun.
此时,删除文件rm -f deletefile.txt
[root@docking ~]# rm -f deletefile.txt
[root@docking ~]# ls
#命令查看这个目录,文件已经不存在了,那么现在我们将其恢复出来。
lsof查看删除的文件进程是否还存在。
如没有安装请自行yum install lsof或者apt-get install lsof
1.类似这种情况,我们可以先lsof查看删除的文件 是否还在
[root@docking ~]# lsof | grep deletefile
138860 /root/deletefile.txt (deleted)
2.恢复cp /proc/pid/fd/1 /指定目录/文件名
进入 进程目录,一般是进入/proc/pid/fd/,针对当前情况:
[root@docking ~]# cd /proc/21796/fd
[root@docking fd]# ll
lrwx------ 1 root root 64 1月
18 22:21 0 -& /dev/pts/0
l-wx------ 1 root root 64 1月
18 22:21 1 -& /root/deletefile.txt (deleted)
lrwx------ 1 root root 64 1月
18 22:21 2 -& /dev/pts/0
恢复操作:
[root@docking fd]# cp 1 ~/deletefile.txt.backup
[root@docking fd]# cat ~/deletefile.txt.backup
This is DeleteFile test.
Add SomeLine into deletefile for fun.
3.恢复完成。
误删除的文件进程已经不存在,借助于工具还原
准备一些文件目录
#准备一份挂载的盘
mkdir backuptest
cd backuptest
mkdir deletetest
mkdir deletetest/innerfolder
echo "Delete a folder test." & deletetest/innerfolder/deletefile.txt
echo "tcpdump:x:172:72::/:/sbin/nologin" & tmppasswd
最后准备的目录结构如下:
taroballs@taroballs-PC:/media/taroballs/taroballs/backuptest$ cd ..
taroballs@taroballs-PC:/media/taroballs/taroballs$ tree backuptest/
backuptest/
├── deletetest
└── innerfolder
└── deletefile.txt
└── tmppasswd
2 directories, 2 files
现在开始删除该目录rm -rf backuptest/
taroballs@taroballs-PC:/media/taroballs/taroballs$ rm -rf backuptest/
taroballs@taroballs-PC:/media/taroballs/taroballs$
这种情况一般是没有守护进行或者后台进程对其持续输入,所以删除就真的删除了。lsof也看不到,故需要采用工具进行恢复。
现在开始进行误删除文件的恢复。
我们采用的工具是extundelete第三方工具。恢复步骤以及注意事项如下:
停止对当前分区做任何操作,防止inode被覆盖。inode被覆盖基本就告别恢复了。
夸张一点讲,比如停止所在分区的服务,卸载目录所在的设备,有必要的情况下都可以断网。
通过dd命令对 当前分区进行备份,防止第三方软件恢复失败导致数据丢失。
适合数据非常重要的情况,这里是例子,所以就没有备份,如备份可以考虑如下方式:dd if=/path/filename of=/dev/vdc1
通过umount命令,对当前设备分区卸载。或者fuser 命令umount /dev/vdb1
如果提示设备busy,可以用fuser命令强制卸载:fuser -m -v -i -k ./
下载第三方工具extundelete安装,搜索误删除的文件进行还原
extundelete工具安装
extundelete下载地址:
wget https://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
解压该文件tar jxvf extundelete-0.2.4.tar.bz2
若报这种错误
[root@docking ~]# tar jxvf extundelete-0.2.4.tar.bz2
tar (child): bzip2:无法 exec: 没有那个文件或目录
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
则使用yum -y install bzip2进行解决
[root@docking ~]# tar jxvf extundelete-0.2.4.tar.bz2
extundelete-0.2.4/
extundelete-0.2.4/acinclude.m4
extundelete-0.2.4/missing
extundelete-0.2.4/autogen.sh
extundelete-0.2.4/aclocal.m4
extundelete-0.2.4/configure
extundelete-0.2.4/LICENSE
extundelete-0.2.4/README
...................................................
extundelete-0.2.4
./configure
若这步骤报错
[root@docking extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
configure: error: in `/root/extundelete-0.2.4':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
则使用yum -y install gcc-c++解决.
若执行上一步仍然报错,
[root@docking extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
configure: error: Can't find ext2fs library
则使用yum -y install e2fsprogs e2fsprogs-devel来解决。
#Ubuntu的解决办法为sudo apt-get install e2fslibs-dev e2fslibs-dev
不出意外的话到这里应该configure能够顺利完成.
[root@docking extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
Writing generated files to disk
[root@docking extundelete-0.2.4]#
最后make然后 make install
[root@docking extundelete-0.2.4]# make
make -s all-recursive
Making all in src
extundelete.cc: 在函数‘ext2_ino_t find_inode(ext2_filsys, ext2_filsys, ext2_inode*, std::string, int)’中:
extundelete.cc:1272:29: 警告:在 {} 内将‘search_flags’从‘int’转换为较窄的类型‘ext2_ino_t {aka unsigned int}’ [-Wnarrowing]
buf, match_name2, priv, 0};
[root@docking extundelete-0.2.4]# make install
Making install in src
/usr/bin/install -c extundelete '/usr/local/bin'
extundelete安装完成.
扫描误删除的文件:
使用df -lh查看挂载:
taroballs@taroballs-PC:~$ df -lh
可用 已用% 挂载点
3% /dev/shm
1% /run/lock
0% /sys/fs/cgroup
1% /run/user/1000
30% /media/taroballs/d8423f8c-d687-4c03-a7c8-06a7fb57f96d
60% /media/taroballs/taroballs
100% /media/taroballs/-12-36-00-00
taroballs@taroballs-PC:~$ cd /media/taroballs/taroballs/
taroballs@taroballs-PC:/media/taroballs/taroballs$
可以看到,我们的目录/media/taroballs/taroballs
挂载到/dev/sdb1
这个文件系统中.
umount我们的挂载盘
taroballs@taroballs-PC:~$ df -lh | grep /dev/sdb1
60% /media/taroballs/taroballs
umount这个目录
taroballs@taroballs-PC:~$ umount /media/taroballs/taroballs
taroballs@taroballs-PC:~$ df -lh | grep /dev/sdb1
taroballs@taroballs-PC:~$
#记得删除一定要后umount哦,不然二次写入谁也帮不了你呢。
通过inode节点恢复
taroballs@taroballs-PC:~$ mkdir recovertest
taroballs@taroballs-PC:~$ cd recovertest/
taroballs@taroballs-PC:~/recovertest$
执行恢复extundelete /dev/sdb1 --inode 2
taroballs@taroballs-PC:/media/taroballs/taroballs$ sudo extundelete /dev/sdb1 --inode 2
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 8 groups loaded.
Contents of inode 2:
| Inode number | Deleted status
deletetest
通过扫描发现了我们删除的文件夹,现在执行恢复操作。
(1)恢复单一文件tmppasswd
taroballs@taroballs-PC:~/recovertest$
extundelete /dev/sdb1 --restore-file passwd
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 8 groups loaded.
Loading journal descriptors ... 46 descriptors loaded.
Successfully restored file tmppasswd
恢复文件是放到了当前目录RECOVERED_FILES。
查看恢复的文件:
taroballs@taroballs-PC:~/recovertest$ cat tmppasswd
tcpdump:x:172:72::/:/sbin/nologin
(2)恢复目录deletetest
extundelete /dev/sdb1 --restore-directory
deletetest
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 8 groups loaded.
Loading journal descriptors ... 46 descriptors loaded.
Searching for recoverable inodes in directory deletetest ...
5 recoverable inodes found.
Looking through the directory structure for deleted files ...
(3)恢复所有
taroballs@taroballs-PC:~/recovertest$ extundelete /dev/sdb1 --restore-all
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 8 groups loaded.
Loading journal descriptors ... 46 descriptors loaded.
Searching for recoverable inodes in directory / ...
5 recoverable inodes found.
Looking through the directory structure for deleted files ...
0 recoverable inodes still lost.
taroballs@taroballs-PC:~/recovertest$ tree
backuptest/
├── deletetest
└── innerfolder
└── deletefile.txt
└── tmppasswd
2 directories, 2 files
(4)恢复指定inode
taroballs@taroballs-PC:~/recovertest$ extundelete /dev/sdb1 --restore-inode 14
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 8 groups loaded.
Loading journal descriptors ... 46 descriptors loaded.
taroballs@taroballs-PC:~/recovertest$ cat file.14
tcpdump:x:172:72::/:/sbin/nologin
#注意恢复inode的时候,恢复 出来的文件名和之前不一样,需要单独进行改名。
最后附上extundelete的用法:
$ extundelete --help
Usage: extundelete [options] [--] device-file
--version, -[vV]
Print version and exit successfully.
Print this help and exit successfully.
--superblock
Print contents of superblock in addition to the rest.
If no action is specified then this option is implied.
Show content of journal.
--after dtime
Only process entries deleted on or after 'dtime'.
--before dtime
Only process entries deleted before 'dtime'.
--inode ino
Show info on inode 'ino'.
--block blk
Show info on block 'blk'.
--restore-inode ino[,ino,...]
Restore the file(s) with known inode number 'ino'.
The restored files are created in ./RECOVERED_FILES
with their inode number as extension (ie, file.12345).
--restore-file 'path'
Will restore file 'path'. 'path' is relative to root
of the partition and does not start with a '/'
The restored file is created in the current
directory as 'RECOVERED_FILES/path'.
--restore-files 'path' Will restore files which are listed in the file 'path'.
Each filename should be in the same format as an option
to --restore-file, and there should be one per line.
--restore-directory 'path'
Will restore directory 'path'. 'path' is relative to the
root directory of the file system.
The restored
directory is created in the output directory as 'path'.
--restore-all
Attempts to restore everything.
-j journal
Reads an external journal from the named file.
-b blocknumber
Uses the backup superblock at blocknumber when opening
the file system.
-B blocksize
Uses blocksize as the block size when opening the file
The number should be the number of bytes.
Make the program silent.
--log filename
Logs all messages to filename.
--log D1=0,D2=filename
Custom control of log messages with comma-separated
Examples below:
list of options.
Dn must be one of info, warn, or
--log info,error
Omission of the '=name' results in messages
--log warn=0
with the specified level to be logged to the console.
--log error=filename
If the parameter is '=0', logging for the specified
level will be turned off.
If the parameter is
'=filename', messages with that level will be written
to filename.
-o directory
Save the recovered files to the named directory.
The restored files are created in a directory
named 'RECOVERED_FILES/' by default.
做技术的段友 天王盖地虎 宝塔镇河妖 偶尔看看云计算 大数据架构、机器瞎学啥的
linux资料总章2.1 1.0写的不好抱歉 但是2.0已经改了很多 但是错误还是无法避免 以后资料会慢慢更新 大家期待吧 命令区 系统管理与维护命令 date date(选项)(参数)|
说明 || :-------- | --------:||...
Ubuntu的发音 Ubuntu,源于非洲祖鲁人和科萨人的语言,发作 oo-boon-too 的音。了解发音是有意义的,您不是第一个为此困惑的人,当然,也不会是最后一个:)大多数的美国人读 ubuntu 时,将 u 作为元音发音,类似单词 who 或者 boo ,重音在第二...
1.Linux下如何用命令查看实时日志(完整命令) tail -f 路径.log查看前多少行 tai-200f 路径.log 2.Linux如何给文件赋予读写操作的权限 chmod 755 路径\文件夹名ugo 755 user有rwx权限 group有rx权限 other...
Linux系统一般有4个主要部分: 内核、shell、文件系统和应用程序。内核、shell和文件系统一起形成了基本的操作系统结构,它们使得用户可以运行程序、管理文件并使用系统。部分层次结构如图1-1所示。 1. linux内核 内核是操作系统的核心,具有很多最基本功能,它负...
如果你喜欢电影版的《三生三世桃花开》,千万不要点进来;如果你是杨洋或刘亦菲的死忠,更加不能点进来;如果你只是为了进来找撩架的借口,我劝你放弃,因为我一向奉行:君子动口更要动手,所以,你未必打得赢我…… 1 言归正传,两年前有幸知道唐七公子,在看过她的《华胥引》后,深深喜欢上...
yhhs hhhdd
亲爱的老爸: 你今天过得好么? 在你的床上睡了一夜,睡得还算不错,但是没有梦到你,醒来了,也没有你。 老妈情绪开始有些波动了,说心里空荡荡的,很想你。她有些极端,责备抢救的医生,责备西医,说是他们害了你。这种情绪可不行,我劝了她,不要去想这个事情,已经过去了,已经发生了,画...
画得太丑,都不好意思发出来。 总算找到了一个看起来稍微好一点的角度拍照。
用善良做地基 用学习去对垒 用檩条去沟通 用仁爱去覆盖 用空间去包容 用门窗去呵护 啊 一座房子 就是一个人生}

我要回帖

更多关于 rm 无法删除 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信