新聞中心
centos 6.5安裝使用數(shù)據(jù)恢復(fù)軟件extundelete

創(chuàng)新互聯(lián)專(zhuān)注為客戶(hù)提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、肥城網(wǎng)絡(luò)推廣、小程序開(kāi)發(fā)、肥城網(wǎng)絡(luò)營(yíng)銷(xiāo)、肥城企業(yè)策劃、肥城品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供肥城建站搭建服務(wù),24小時(shí)服務(wù)熱線(xiàn):028-86922220,官方網(wǎng)址:www.cdcxhl.com
一、安裝
(1) 首先extundelete軟件所依賴(lài)e2fsprogs e2fsprogs-libs e2fsprogs-devel軟件包
(2) 下載extundelete,官方網(wǎng)站是http://extundelete.sourceforge.net/ 目前的穩(wěn)定版本是extundelete-0.2.4
[root@local app]# tar jxvf extundelete-0.2.4.tar.bz2
[root@localapp]# cd extundelete-0.2.4
[root@localapp]# ./configure 結(jié)果Writing generated files to disk
[root@localapp]# make 結(jié)果extundelete.cc:571: 警告:未使用的參數(shù)‘flags’
[root@localapp]# make install
結(jié)果 /usr/bin/install -c extundelete'/usr/local/bin'
(3) 解壓安裝
(4) 安裝完成后,就可以進(jìn)行數(shù)據(jù)恢復(fù)的操作了
二、實(shí)用方法
(1) 命令格式 extundelete [options’選項(xiàng)’] [action‘命令’] device-file‘設(shè)備文件’
(2) 參數(shù)介紹extundelete –help
參數(shù):
--version,-[vV]顯示軟件版本號(hào)
--help,顯示軟件幫助信息
--superblock顯示超級(jí)塊信息
--journal,顯示日志信息
--after dtime,時(shí)間參數(shù),表示在某時(shí)間段之后被刪除的文件或目錄
--before dtime,時(shí)間參數(shù),表示在某時(shí)間段之前被刪除的文件或目錄
動(dòng)作:
--inode ino,顯示節(jié)點(diǎn)ino 的信息
--block blk 顯示數(shù)據(jù)塊 blk 的信息
--restore-inode ino [,ino,…]恢復(fù)命令參數(shù),表示恢復(fù)節(jié)點(diǎn)“ino”的文件,恢復(fù)的文件 會(huì)自動(dòng)
存放在當(dāng)前目錄下的RESTORED_FILES文件夾中,使用節(jié)點(diǎn)編號(hào)作為擴(kuò)展名
--restore-file ‘path’ ,恢復(fù)命令蠶食,表示將恢復(fù)指定路徑的文件,并把恢復(fù)的文件 放在當(dāng)
前目錄下的RECOVERED_FILES目錄中
--restore-files‘path’,恢復(fù)命令參數(shù),表示將恢復(fù)在路徑中已列出的所有文件
--restore-all,恢復(fù)命令參數(shù),表示將嘗試恢復(fù)所有目錄和文件
-j journal 表示從已經(jīng)命名的文件中讀取擴(kuò)展日志
-b blocknumber,表示使用之前備份的超級(jí)快來(lái)打開(kāi)文件系統(tǒng),一般用于查看現(xiàn)有超級(jí)快
是不是當(dāng)前所要的文件
-B blocksize,通過(guò)制定數(shù)據(jù)塊大小來(lái)打開(kāi)文件系統(tǒng),一般用于查看已經(jīng)知道大小的文件
三、extundelete數(shù)據(jù)恢復(fù)過(guò)程
在數(shù)據(jù)被誤刪后,第一時(shí)間要做的是卸載被刪除數(shù)據(jù)所在的磁盤(pán)或者磁盤(pán)分區(qū),如果是系統(tǒng)根分區(qū)的數(shù)據(jù)遭到誤刪,就需要將系統(tǒng)進(jìn)入單用戶(hù),并且將根目錄以只讀的模式掛載,這樣做的原因是當(dāng)問(wèn)及被刪除后,僅僅是將文件的inode節(jié)點(diǎn)中的扇區(qū)指針清零,實(shí)際文件還儲(chǔ)存在磁盤(pán)上,如果磁盤(pán)以只讀模式掛載,這些已刪除文件的數(shù)據(jù)塊就可能被操作系統(tǒng)重新分配出去了,在這些數(shù)據(jù)塊被新的數(shù)據(jù)覆蓋后,這些數(shù)據(jù)就真的丟失了,恢復(fù)工具也沒(méi)辦法恢復(fù)。
(1) 通過(guò)extundelete恢復(fù)單個(gè)文件操作以ext4文件系統(tǒng)環(huán)境為例,我自己添加一塊磁盤(pán)設(shè)備為/dev/sdb4
[root@local 桌面]# mkdir /data
[root@local 桌面]# mkfs.ext4 /dev/sdb4
[root@local 桌面]# mount /dev/sdb4 /data/
[root@local 桌面]# cp /etc/passwd /data/
[root@local data]# cp -r /root/app/extundelete-0.2.4 /data/
[root@local data]# md5sum passwd
90a8c0bb0bea88d6ce2ab252bd55ecfc passwd
[root@local data]# rm -rf /data/*
(2) 卸載磁盤(pán)分區(qū)
[root@local data]# cd
[root@local ~]# umount /data/
(3) 通過(guò)extundelete命令查下/dev/sdb4分區(qū)可恢復(fù)的數(shù)據(jù)信息一般”root”目錄的 inode 值為
2, 一個(gè)分區(qū)掛載到一個(gè)目錄下時(shí),這個(gè)”root”目錄的 inode 值為 2
[root@local ~]# extundelete /dev/sdb4 --inode 2
………
File name | Inode number | Deleted status
. 2
.. 2
lost+found 11 Deleted
passwd 12 Deleted
extundelete-0.2.4 131073 Deleted
(4) 恢復(fù)單個(gè)文件,恢復(fù)單個(gè)文件的參數(shù)是--restore-file 這里需要注意的是參數(shù)后面
指定的是恢復(fù)文件路徑,這個(gè)路徑是文件的相對(duì)路徑。相對(duì)路徑是相對(duì)于原來(lái)存儲(chǔ)路徑而言
的,如果存儲(chǔ)路徑是/data/passwd,那么參數(shù)后面直接寫(xiě)pass我的,如果原來(lái)的路徑是/data/
extundelete-0.2.4/ config.h那么在參數(shù)后面就寫(xiě)extundelete-0.2.4/ config.h即可。
[root@local ~]# extundelete /dev/sdb4 --restore-file passwd
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 40 groups loaded.
Loading journal descriptors ... 52 descriptors loaded.
Successfully restored file passwd
[root@local ~]# cd RECOVERED_FILES/
[root@local RECOVERED_FILES]# ls
passwd
[root@local RECOVERED_FILES]# md5sum passwd
90a8c0bb0bea88d6ce2ab252bd55ecfc passwd
通過(guò)extundelete恢復(fù)單個(gè)目錄
(1) 通過(guò)參數(shù)—restore-directory選項(xiàng)即可恢復(fù)指定目錄的數(shù)據(jù),想要恢復(fù)/data/extundelete- 0.2.4下的數(shù)據(jù)
[root@local extundelete-0.2.4]# extundelete /dev/sdb4 --restore-directory extundelete-0.2.4
[root@local extundelete-0.2.4]# cd RECOVERED_FILES/
[root@local RECOVERED_FILES]# ls
extundelete-0.2.4
[root@local RECOVERED_FILES]# du -sh extundelete-0.2.4/
4.8M extundelete-0.2.4/
可以看到目錄extundelete-0.2.4已經(jīng)恢復(fù)了
通過(guò)extundelete恢復(fù)所有誤刪的數(shù)據(jù)
(1) 當(dāng)需要恢復(fù)的數(shù)據(jù)較多時(shí),一個(gè)一個(gè)的恢復(fù)是非常繁瑣的,此時(shí)可以通過(guò)--restore-all來(lái)恢復(fù)所有的文件或文件夾
[root@local ~]# cd /
[root@local /]# ls
app cgroup etc lib64 misc opt sbin sys var
bin data home lost+found mnt proc selinux tmp
boot dev lib media net root srv usr
[root@local /]# extundelete /dev/sdb4 --restore-all
[root@local /]# ls
app cgroup etc lib64 misc opt root srv usr
bin data home lost+found mnt proc sbin sys var
boot dev lib media net RECOVERED_FILES selinux tmp
[root@local /]# cd RECOVERED_FILES/
[root@local RECOVERED_FILES]# ls
extundelete-0.2.4 passwd
[root@local RECOVERED_FILES]# du -sh extundelete-0.2.4/
4.8M extundelete-0.2.4/
通過(guò)extundelete恢復(fù)某個(gè)時(shí)間段的數(shù)據(jù)
(1) 當(dāng)刪除的數(shù)據(jù)量非常大的時(shí)候,很多數(shù)據(jù)沒(méi)有用,這時(shí)我們要恢復(fù)某個(gè)時(shí)間短的數(shù)據(jù),
extundelete提供了--after,--before參數(shù)。
首先假設(shè)在/data分區(qū)下剛剛創(chuàng)建了extundelete-0.2.4.tar.bz2,然后刪除此文件,接著卸
載/data分區(qū),開(kāi)始恢復(fù)一小時(shí)內(nèi)的數(shù)據(jù)操作如下:
[root@local data]# cp /root/extundelete-0.2.4.tar.bz2 /data/
[root@local data]# ls
extundelete-0.2.4.tar.bz2
[root@local data]# date +%s
1447823133
[root@local data]# rm -rf extundelete-0.2.4.tar.bz2
[root@local data]# cd
[root@local ~]# umount /data
[root@local ~]# date +%s
1447823221
[root@local ~]# cd /data/
[root@local data]# ls
[root@local data]# extundelete --after 1447819621 --restore-all /dev/sdb4
[root@local data]# ls
[root@local data]# cd RECOVERED_FILES/
[root@local RECOVERED_FILES]# ls
extundelete-0.2.4.tar.bz2
注:可以看到剛才刪除的文件已經(jīng)恢復(fù)這個(gè)操作需要注意--after參數(shù)后面跟的是時(shí)間的總秒數(shù)起算時(shí)間“1970-01-01 00:00:00 UTC”通過(guò)date +%s 命令可將當(dāng)前時(shí)間轉(zhuǎn)換成總秒數(shù)之后恢復(fù)1小時(shí)以前的數(shù)據(jù)就需要用1447823221減去60*60=3600所得的數(shù)
新聞名稱(chēng):CentOS6.5安裝使用數(shù)據(jù)恢復(fù)軟件extundelete
路徑分享:http://m.5511xx.com/article/dpjecdo.html


咨詢(xún)
建站咨詢(xún)
