linux恢复 rm -rf 删除的文件

本文档记录了在Linux系统中不慎使用rm -rf命令删除文件后的恢复过程。首先,需要安装必要的软件包如lvm2、e2fsprogs等。然后,通过查看物理卷、卷组和逻辑卷信息来恢复LVM2_member类型的文件系统。接下来,使用extundelete工具进行文件恢复,包括如何指定时间点、文件名和inode号来精确恢复。最后,针对恢复过程中可能出现的问题和注意事项进行了说明,例如恢复空文件、相同文件名的文件恢复等。
摘要由CSDN通过智能技术生成

很杯具的一个问题,一时手快,用rm -rf 删除了文件,所以有了这篇文章的痛苦过程。不是很完善,只是简单记录了过程。建议大家不用rm -rf 这个命令。否则有一天会后悔的。以下就是清洗杯具的一些记录:


yum -y install texinfo-tex
yum -y install lvm2
yum install e2fsprogs e2fsprogs-devel e2fsprogs-libs



遇到下面的问题,参考了:http://hi.baidu.com/williwill/item/7a36fdd92340b2ee55347f13 如下:

系统启动到request_module: runaway loop modprobe binfmt-464c挂起

利用U盘系统,挂载硬盘出现:mount: unknown filesystem type 'LVM2_member'

解决办法:

需要安装 lvm2

然后按一下步骤:

1、查看物理卷:pvs

PV       VG       Fmt   Attr PSize PFree
   /dev/sda2   VolGroup00 lvm2 a- 279.22G 32.00M


2、查看卷组:vgs

VG       #PV #LV #SN Attr VSize VFree
   VolGroup00 1 4 0 wz--n- 279.22G 32.00M

3、查看逻辑卷:lvdisplay

--- Logical volume ---
   LV Name             /dev/VolGroup00/LogVol03
   VG Name             VolGroup00
   LV UUID             YhG8Fu-ZGPk-qt8D-AxgC-DzOU-dg1F-z71feI
   LV Write Access        read/write
  LV Status              unenable
   # open                 1
   LV Size             245.97 GB
   Current LE          7871
   Segments             1
   Allocation          inherit
   Read ahead sectors     auto
   - currently set to     256
   Block device           253:2

4、如未激活,需要激活逻辑卷:vgchange -ay /dev/VolGroup00

LV Status              available

5、挂载逻辑卷:mount   /dev/VolGroup00/LogVol03   /home/lvm

 

 

 

 

 

 

ext3/4文件系统下用rm -rf 删除文件的恢复

 

 

准备工作
主要通过 extundelete 0.2.0完成恢复

官网:http://extundelete.sourceforge.net/

下载地址:http://sourceforge.net/projects/extundelete/files/extundelete/0.2.0/extundelete-0.2.0.tar.bz2/download


需要依赖两个包

e2fsprogs

下载地址:http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/1.41.14/e2fsprogs-1.41.14.tar.gz/download

e2fsprogs-libs

下载地址:

http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/1.41.14/e2fsprogs-libs-1.41.14.tar.gz/download

 

按e2fsprogs--e2fsprogs-libs--extundelete的顺序逐一编译安装:

./configure
make

make install

 

必须先umount要恢复文件的分区或者把分区改为只读模式,命令:mount –o remout,ro 分区(例如:dev/hda1)

 

参数解析:

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".

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值