导航:首页 > 操作系统 > linuxext4文件恢复

linuxext4文件恢复

发布时间:2022-07-15 21:36:57

1. linux系统如何用命令恢复硬盘数据

formost 是一个基于文件头和尾部信息以及文件的内建数据结构恢复文件的命令行工具。这个过程通常叫做数据挖掘(data carvubg)。formost 可以分析由 dd、Safeback、Encase 等生成的镜像文件,也可以直接分析驱动器。文件头和尾可以通过配置文件设置,也可以通过命令行开关使用 formost 内建的文件类型。formost 最初是由美国空军特别调查室(Air Force Office of Special Investigations)和信息系统安全研究中心(The Center for Information Systems Security Studies and Research)开发的,现在使用 GPL 许可。Foremost 支持恢复如下格式:avi, bmp, dll, doc, exe, gif, htm, jar, jpg, mbd, mov, mpg, pdf, png, ppt, rar, rif, sdw, sx, sxc, sxi, sxw, vis, wav, wmv, xls, zip。 针对 Linux 下的 ext 文件系统来说,常用的 Linux 文件删除恢复工具有 debugfs、ext3grep、extundelete 等。extundelete 是一个开源的数据恢复工具,支持 ext3、ext4 文件系统

2. linux系统ext4文件系统rm删除的文件怎么恢复

系统:Oracle Linux OEL6.5 x64
分区格式:ext4
起因:今天手贱在自己服务器上误操作将/home/ORACLE目录给删除了,结果导致服务全面崩溃
遂谷歌了一把发现了神器 extundelete(如果是ext3文件系统请使用ext3grep,本人未做测试),这玩意可比瘟得死下面的各种恢复工具强大多了(至少本人是这么认为的)。

关于extundelete这个工具的说明使用,官方网站extundelete.sourceforge.net是这样说的,extundelete是一种实用的工具,可以从ext3或ext4分区恢复被删除的文件,不能保证恢复所有的文件,所以最好能做好备份.它的最新版本是0.2.4
为什么要用extundelete?
官方这样描述,如果您已经在ext4的文件系统中删除了文件,选extundelete是一个不错的选择,它能够恢复已删除文件的文件名及内容.如果是在ext3的文件系统中删除了文件,extundelete和ext3grep比较仍然有一些优点,extundelete分析日志文件后,能够立即恢复一个文件,ext3grep分析整个硬盘才开始恢复硬盘中的文件,ext3grep方法是是有效的从一个小分区恢复多个文件,所以相比而言,如果需要从一个大的分区中恢复文件,extundelete要快些.
注意:在安装extundelete之前,要确定已经安装了e2fsprogs和e2fslibs(确定e2fsprogs的版本在1.41或者更高版本,可通过运行命令mpe2fs来查看版本).
一、下载及安装软件
extundelete 主页:http://extundelete.sourceforge.net/
下载地址:http://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2 (需 跨墙)
ubuntu用户可直接安装: apt-get install extundelete

# wget http://nchc.dl.sourceforge.NET/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
# tar -jxvf extundelete-0.2.4.tar.bz2
# cd extundelete-0.2.4
# ./configure --prefix=/usr/local/extundelete
# make && make install

extundelete --help 查看有哪些选项 --restore-file 指定恢复文件, --restore-all 恢复全部等等,恢复完成后,恢复的文件就在当前目录下生成的RECOVERED_FILES的目录里.

实测:rm -rf /home/oracle
[plain] view plain
[root@rac1 extundelete-0.2.4]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root ext4 50G 19G 29G 40% /
tmpfs tmpfs 998M 80K 998M 1% /dev/shm
/dev/sda1 ext4 477M 55M 397M 13% /boot
/dev/mapper/VolGroup-lv_home ext4 28G 44M 26G 1% /home
二、数据恢复
1.卸载需要恢复文件的分区
[root@rac1 extundelete-0.2.4]# fuser -k ?home <-- 结束使用某分区的进程树
[root@rac1 extundelete-0.2.4]# umount /home <-- 卸载分区

2.使用extundelete查看分区上存在的文件

[plain] view plain
[root@rac1 extundelete-0.2.4]# extundelete --inode 2 /dev/mapper/VolGroup-lv_home <div class="crayon-pre" style="box-sizing: border-box; padding: 0px; margin: 0px; white-space: pre; overflow: visible; font-family: monospace !important; background-image: none !important; border: none !important; color: rgb(255, 255, 255) !important; font-size: 15px !important; line-height: 20px !important;"><div class="crayon-line" id="crayon-53febd9362e4c249413479-1" style="box-sizing: border-box; font-family: inherit; border: 0px; padding: 0px 5px; margin: 0px; height: inherit; font-size: inherit !important; line-height: inherit !important; background-position: 0px 50%;"><span class="crayon-c" style="box-sizing: border-box; font-family: inherit; height: inherit; font-size: inherit !important; line-height: inherit !important; color: rgb(255, 140, 0) !important;"> # --inode 为查找某i节点中的内容,使用2则说明为搜索,如果需要进入目录搜索,只须要指定目录I节点即可</span></div></div>NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 221 groups loaded.
Group: 0
Contents of inode 2:
0000 | ed 41 00 00 00 10 00 00 74 85 fe 53 72 85 fe 53 | .A......t..Sr..S
0010 | 72 85 fe 53 00 00 00 00 00 00 03 00 08 00 00 00 | r..S............
0020 | 00 00 08 00 02 00 00 00 0a f3 01 00 04 00 00 00 | ................
0030 | 00 00 00 00 00 00 00 00 01 00 00 00 11 24 00 00 | .............$..
0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0080 | 1c 00 00 00 cc 8f 32 d4 cc 8f 32 d4 1c 8c d6 9d | ......2...2.....
0090 | d1 21 ea 53 00 00 00 00 00 00 00 00 00 00 02 ea | .!.S............
00a0 | 07 06 3c 00 00 00 00 00 21 00 00 00 00 00 00 00 | ..<.....!.......
00b0 | 73 65 6c 69 6e 75 78 00 00 00 00 00 00 00 00 00 | selinux.........
00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00d0 | 00 00 00 00 00 00 00 00 00 00 00 00 73 79 73 74 | ............syst
00e0 | 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f 72 3a 68 6f | em_u:object_r:ho
00f0 | 6d 65 5f 72 6f 6f 74 5f 74 3a 73 30 00 00 00 00 | me_root_t:s0....

Inode is Allocated
File mode: 16877
Low 16 bits of Owner Uid: 0
Size in bytes: 4096
Access time: 1409189236
Creation time: 1409189234
Modification time: 1409189234
Deletion Time: 0
Low 16 bits of Group Id: 0
Links count: 3
Blocks count: 8
File flags: 524288
File version (for NFS): 0
File ACL: 0
Directory ACL: 0
Fragment address: 0
Direct blocks: 127754, 4, 0, 0, 1, 9233, 0, 0, 0, 0, 0, 0
Indirect block: 0
Double indirect block: 0
Triple indirect block: 0

File name | Inode number | Deleted status
. 2
.. 2
lost+found 11
oracle 523265 Deleted

被删除的oracle文件夹已经被找到,状态为已经删除,接下来就将它们恢复出来。

[root@rac1
Desktop]# extundelete --restore-all /dev/mapper/VolGroup-lv_home # --restore-all是全部恢复 ,默认全将恢复出来的文件放在当前路径 RECOVERED_FILES/ 目录下,文件名为 file.I节点号
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 221 groups loaded.
Loading journal descriptors ... 3108 descriptors loaded.
Searching for recoverable inodes in directory / ...
3576 recoverable inodes found.
Looking through the directory structure for deleted files ...
0 recoverable inodes still lost.

[root@rac1 Desktop]# ls RECOVERED_FILES/
lost+found oracle
[root@rac1 Desktop]# mount /home
[root@rac1 Desktop]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root ext4 50G 21G 26G 45% /
tmpfs tmpfs 998M 80K 998M 1% /dev/shm
/dev/sda1 ext4 477M 55M 397M 13% /boot
/dev/mapper/VolGroup-lv_home ext4 28G 44M 26G 1% /home
[root@rac1 Desktop]# mv RECOVERED_FILES/oracle /home

[root@rac1
Desktop]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root ext4 50G 19G 29G 40% /
tmpfs tmpfs 998M 80K 998M 1% /dev/shm
/dev/sda1 ext4 477M 55M 397M 13% /boot
/dev/mapper/VolGroup-lv_home ext4 28G 2.6G 24G 10% /home

至此2.6G的数据恢复完毕。
恢复之后,权限不一致的,别忘了授权。
[root@rac1
~]# chmod -R 777 /home/oracle

验证数据是否可用:
[root@rac1
home]# su oracle
[oracle@rac1 home]$ db11g

SQL*Plus:
Release 11.2.0.3.0 Proction on Thu Aug 28 14:09:49 2014

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to an idle instance.

SQL> 搞定!

3. 如何恢复被Linux破坏的硬盘分区表

你好,
试一下TestDisk,支持以下功能:
修复分区表,
恢复已删除分区
用FAT32备份表恢复启动扇区
重建FAT12/FAT16/FAT32启动扇区
修复FAT表
重建NTFS启动扇区
用备份表恢复NTFS启动扇区
用MFT镜像表(MFT
Mirror)修复MFT表
查找ext2/ext3/ext4备份的SuperBlock
从FAT,NTFS及ext2文件系统恢复删除文件
从已删除的FAT,NTFS及ext2/ext3/ext4分区复制文件.
自己搜索下载

4. Linux ext4格式硬盘 在win系统加载过以后 插回Linux系统不能加载了

win系统不支持linux的ext3 ext4文件系统,正常情况系统也不会写入这些linux文件系统的磁盘,描述的情况可能有写入破坏了分区信息,如果有数据建议先恢复数据再说其他。

阅读全文

与linuxext4文件恢复相关的资料

热点内容
农行app怎么开网银 浏览:649
java迭代器遍历 浏览:301
闽政通无法请求服务器是什么 浏览:48
怎么做积木解压神器 浏览:203
王者荣耀解压玩具抽奖 浏览:49
12位是由啥加密的 浏览:868
程序员编迷你世界代码 浏览:895
php取现在时间 浏览:246
单片机高吸收 浏览:427
怎么区分五代头是不是加密喷头 浏览:244
hunt测试服务器是什么意思 浏览:510
2013程序员考试 浏览:641
毕业论文是pdf 浏览:736
服务器跑网心云划算吗 浏览:471
单片机定时器计数初值的计算公式 浏览:801
win7控制台命令 浏览:567
猫咪成年app怎么升级 浏览:692
360有没有加密软件 浏览:315
清除cisco交换机配置命令 浏览:751
华为删除交换机配置命令 浏览:473