免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: 南非蚂蚁

手抖的后果:误执行"rm -rf"命令之后(获奖名单已公布-2012-9-6) [复制链接]

论坛徽章:
0
发表于 2012-06-27 14:06 |显示全部楼层
本帖最后由 南非蚂蚁 于 2012-06-27 14:08 编辑

给出一些extundelete
实用参数

Below is an explanation of the command-line options recognized by extundelete 0.2.0.

--version
Prints the version number of extundelete.

--help
Prints a brief usage summary for extundelete.

Partition name
Name of the partition that has deleted files, such as /dev/sda3. Could also be the file name of a copy of the partition, such as that made with dd.

--superblock
Prints information about the filesystem from the superblock.

--journal --superblock
Prints information about the journal from the journal's superblock.

--inode #
Prints the information from the inode number of the filesystem given, such as "--inode 2".

--block #
Prints the contents of the block, called as "--block 9652".

--restore-file path/to/deleted/file
Attemps to restore the file which was deleted at the given filename, called as "--restore-file dirname/filename".

--restore-inode #
Used to restore inodes by number, called as "--restore-inode 2569". Also accepts a list of inodes separated by only commas, such as "--restore-inode 2569,5692,6925".

--restore-files filename
Restores a list of files. First, construct a list of files in the same style as would be used in the --restore-file option, and save it to the file "filename". Then, this option may be used to attempt to restore those files with a single call to extundelete. This form also reduces redundancy from multiple calls parsing the journal multiple times.

--restore-all
Restores all files possible to undelete to their names before deletion, when possible. Other files are restored to a filename like "file.NNNN".

--restore-directory path/of/directory
Restores all files possible to link to specified directory to their names before deletion, when possible.

-j journal_dev
Specifies the device that is the external journal of the file system.

-b block_number
Specifies the block number of the backup superblock to be used when opening the file system.

-B block_size
Specifies the block size of the partition to be used when opening the file system.

--before date
Only restore files deleted before the date specified, which should be in the form of the number of seconds since the UNIX epoch. Use a shell command like
$ date -d "Aug 1 9:02" +%s
to convert a human-readable date to the proper format. The conversion from the number of seconds to a readable format may be found by using either of the following:
$ date -d@1234567890
$ perl -le "print scalar localtime 1234567890"
--after date
Only restore files deleted after the date specified, which should be in the form of the number of seconds since the UNIX epoch. See the notes for the --before option for more information.

论坛徽章:
0
发表于 2012-06-27 14:09 |显示全部楼层
悲疼也。。

曾经想删除某目录下的所有过期日志 在当前使用 目录 rm -rf *  即可,但是考虑到手抖问题 我还是退回上层目录 想以 rm -rf ./abc/* 来删除,

结果 手抖分心 还是敲成了 rm -rf ./*  

后果就是 傻乎乎的看着 rm -rf ./*  后的刷屏 结果是惨不忍睹的。。。。。。

论坛徽章:
0
发表于 2012-06-27 14:11 |显示全部楼层
运维-那些事 发表于 2012-06-27 14:09
悲疼也。。

曾经想删除某目录下的所有过期日志 在当前使用 目录 rm -rf *  即可,但是考虑到手抖问题 我 ...



你的手抖的这里厉害啊,按ctrl+c啊{:3_191:}

论坛徽章:
0
发表于 2012-06-27 14:15 |显示全部楼层
有这样的经历,不过是在测试机上面,也是在根目录~想删除oracle目录,写的是oracle_home,结果发现oracle_home定义错误,直接全给删掉了,那叫一个悲催啊,还好是测试环境,不然后果不堪设想

论坛徽章:
0
发表于 2012-06-27 14:16 |显示全部楼层
回复 5# 南非蚂蚁


    哟,老高也有过这样的经历啊,难得!直接把那人拖出去TJJTDS啊!

论坛徽章:
0
发表于 2012-06-27 14:20 |显示全部楼层
hnkdrory 发表于 2012-06-27 14:16
回复 5# 南非蚂蚁



呵呵,我经历的误删除情况很多,有自己误删除的,有别人误删除的,曾经给别人恢复过误删除的900多G数据!

论坛徽章:
0
发表于 2012-06-27 14:24 |显示全部楼层
看看这两个的区别

rm -rf /usr /lib/nvidia-current/xorg/xorg

rm -rf /usr/lib/nvidia-current/xorg/xorg

论坛徽章:
2
2015年迎新春徽章
日期:2015-03-04 09:55:28IT运维版块每日发帖之星
日期:2016-07-29 06:20:00
发表于 2012-06-27 14:27 |显示全部楼层
回复 29# 南非蚂蚁

平时没有误删除导致的故障,所以这方面没啥经验.演练的时候,拿备份的数据,在新的系统上面进行恢复.
恢复办法:rysnc命令,把常用脚本和所需数据推送到新的服务器上.
只是备份不是实时的,多少会损失最新的更新.
   

论坛徽章:
2
午马
日期:2015-01-27 11:22:392015年辞旧岁徽章
日期:2015-03-03 16:54:15
发表于 2012-06-27 14:36 |显示全部楼层
回复 15# ruochen


    谁在mv的最后参数上加 * 啊。。。。。。 那是基本功问题了。。。

论坛徽章:
1
CU十二周年纪念徽章
日期:2013-10-24 15:41:34
发表于 2012-06-27 14:45 |显示全部楼层
有误删的经历。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP