導航:首頁 > 操作系統 > 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文件恢復相關的資料

熱點內容
程序員越來越困 瀏覽:865
女朋友java程序員 瀏覽:338
魔獸世界加密貨幣 瀏覽:783
程序員打卡日記 瀏覽:766
車間壓縮空氣有水怎麼處理 瀏覽:835
java類調用php 瀏覽:475
php時間控制 瀏覽:807
用流程圖表示演算法分類 瀏覽:931
本地git文件夾誤刪除怎麼恢復 瀏覽:747
java快速開發平台開源 瀏覽:996
java實戰從入門 瀏覽:155
javahello程序 瀏覽:13
java系統輸出 瀏覽:934
430單片機存儲 瀏覽:396
私人雲php源碼 瀏覽:449
解壓系統內核 瀏覽:801
java精確兩位小數 瀏覽:839
安卓系統如何看游戲幀數 瀏覽:435
生產節拍模擬app哪個好用 瀏覽:437
光遇安卓渠道怎麼轉 瀏覽:421