其他分享
首页 > 其他分享> > extundelete恢复误删目录ext4

extundelete恢复误删目录ext4

作者:互联网

https://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2

[root@test bin]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Dec 30 08:20:08 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=691c35af-0e18-429e-a5d7-4d1ceb2e8e17 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/mapper/VolGroup-lv_app /app                        ext4    defaults 1 1
[root@test bin]# rpm -aq|grep e2fsprogs
e2fsprogs-libs-1.41.12-21.el6.x86_64
e2fsprogs-1.41.12-21.el6.x86_64
[root@test bin]# pwd
/usr/local/sa/sa-agent/bin
[root@test bin]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       85G   33G   48G  41% /
tmpfs                  16G   72K   16G   1% /dev/shm
/dev/sda1             477M   34M  419M   8% /boot
/dev/mapper/VolGroup-lv_app
                      896G  260G  591G  31% /app
[root@test bin]# cd /root
[root@test ~]# mv /home/test/extundelete-0.2.4.tar.bz2 /root/
[root@test ~]# ll
总用量 32600
-rw-rw-rw-  1 root root     8805 2月  27 2019 36c221be-6ab2-ef53-1589-fe16877914f8.pl
-rwxrwxrwx  1 root root     2125 2月  27 2019 36c221be-6ab2-ef53-1589-fe16877914f8.sh
-rw-------. 1 root root     1629 12月 30 2014 anaconda-ks.cfg
drwxr-x---  2 root root     4096 8月  13 2020 bea
-rw-r--r--  1 root root     5351 9月  25 2017 carTrackService.wsdl
-rw-r--r--  1 root root     5298 9月  26 2017 carTrackService.wsdl.1
drwxr-xr-x. 7 root root     4096 6月   8 2020 Desktop
drwxr-xr-x  2 root root     4096 4月   1 2019 dhc
drwxr-xr-x. 2 root root     4096 12月 30 2014 Documents
drwxr-xr-x. 2 root root     4096 12月 30 2014 Downloads
-rw-rw-r--  1 test test   108472 4月  27 2020 extundelete-0.2.4.tar.bz2
-rw-r--r--. 1 root root    51983 12月 30 2014 install.log
-rw-r--r--. 1 root root    10033 12月 30 2014 install.log.syslog
-rw-r--r--  1 root root     3849 2月  28 2019 linux.zip
drwxr-xr-x. 2 root root     4096 12月 30 2014 Music
-rw-r--r--. 1 root root  3572892 6月  16 11:28 ntpdate.log
drwxr-xr-x. 2 root root     4096 12月 30 2014 Pictures
drwxr-xr-x. 2 root root     4096 12月 30 2014 Public
-rw-rw-rw-  1 root root     1065 2月  27 2019 readme.txt
-rw-r-----  1 root root 29525966 1月  18 2019 Report_LTE RRU鎶ヨ〃_鍗庣洓鍙鍖朢RU鎶ヨ〃_20190118.csv
drwxr-xr-x. 2 root root     4096 12月 30 2014 Templates
drwxr-xr-x. 2 root root     4096 12月 30 2014 Videos
-rw-r--r--  1 root root     3136 9月  19 2017 wget-log
-rw-r--r--  1 root root     3791 11月  3 2017 wget-log.1
[root@test ~]# mkdir reco
[root@test ~]# mv extundelete-0.2.4.tar.bz2 ./reco/
[root@test ~]# cd reco
[root@test reco]# tar jxvf extundelete-0.2.4.tar.bz2 
extundelete-0.2.4/
extundelete-0.2.4/acinclude.m4
extundelete-0.2.4/missing
extundelete-0.2.4/autogen.sh
extundelete-0.2.4/aclocal.m4
extundelete-0.2.4/configure
extundelete-0.2.4/LICENSE
extundelete-0.2.4/README
extundelete-0.2.4/install-sh
extundelete-0.2.4/config.h.in
extundelete-0.2.4/src/
extundelete-0.2.4/src/extundelete.cc
extundelete-0.2.4/src/block.h
extundelete-0.2.4/src/kernel-jbd.h
extundelete-0.2.4/src/insertionops.cc
extundelete-0.2.4/src/block.c
extundelete-0.2.4/src/cli.cc
extundelete-0.2.4/src/extundelete-priv.h
extundelete-0.2.4/src/extundelete.h
extundelete-0.2.4/src/jfs_compat.h
extundelete-0.2.4/src/Makefile.in
extundelete-0.2.4/src/Makefile.am
extundelete-0.2.4/configure.ac
extundelete-0.2.4/depcomp
extundelete-0.2.4/Makefile.in
extundelete-0.2.4/Makefile.am
[root@test reco]# ll
总用量 112
drwxr-xr-x 3 1000 1000   4096 1月   4 2013 extundelete-0.2.4
-rw-rw-r-- 1 test test 108472 4月  27 2020 extundelete-0.2.4.tar.bz2
[root@test reco]# cd extundelete-0.2.4
[root@test extundelete-0.2.4]# yum install e2fsprogs-devel -y
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Determining fastest mirrors
c6-http                                                                                                                                              | 2.9 kB     00:00     
解决依赖关系
--> 执行事务检查
---> Package e2fsprogs-devel.x86_64 0:1.41.12-21.el6 will be 安装
--> 完成依赖关系计算

依赖关系解决

============================================================================================================================================================================
 软件包                                       架构                                版本                                           仓库                                  大小
============================================================================================================================================================================
正在安装:
 e2fsprogs-devel                              x86_64                              1.41.12-21.el6                                 c6-http                              160 k

事务概要
============================================================================================================================================================================
Install       1 Package(s)

总下载量:160 k
Installed size: 529 k
下载软件包:
e2fsprogs-devel-1.41.12-21.el6.x86_64.rpm                                                                                                            | 160 kB     00:00     
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
  正在安装   : e2fsprogs-devel-1.41.12-21.el6.x86_64                                                                                                                    1/1 
  Verifying  : e2fsprogs-devel-1.41.12-21.el6.x86_64                                                                                                                    1/1 

已安装:
  e2fsprogs-devel.x86_64 0:1.41.12-21.el6                                                                                                                                   

完毕!
[root@test extundelete-0.2.4]# rpm -aq|grep e2fspro
e2fsprogs-libs-1.41.12-21.el6.x86_64
e2fsprogs-devel-1.41.12-21.el6.x86_64
e2fsprogs-1.41.12-21.el6.x86_64
[root@test extundelete-0.2.4]# pwd
/root/reco/extundelete-0.2.4
[root@test extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
Writing generated files to disk
[root@test extundelete-0.2.4]# make && make install
make -s all-recursive
Making all in src
extundelete.cc:571: 警告:未使用的参数‘flags’
Making install in src
  /usr/bin/install -c extundelete '/usr/local/bin'
[root@test extundelete-0.2.4]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       85G   33G   48G  41% /
tmpfs                  16G   72K   16G   1% /dev/shm
/dev/sda1             477M   34M  419M   8% /boot
/dev/mapper/VolGroup-lv_app
                      896G  260G  591G  31% /app
[root@test extundelete-0.2.4]# extundelete -h
extundelete: invalid option -- 'h'
No action specified; implying --superblock.
extundelete: Missing device name.
Usage: extundelete [options] [--] device-file
Options:
  --version, -[vV]       Print version and exit successfully.
  --help,                Print this help and exit successfully.
  --superblock           Print contents of superblock in addition to the rest.
                         If no action is specified then this option is implied.
  --journal              Show content of journal.
  --after dtime          Only process entries deleted on or after 'dtime'.
  --before dtime         Only process entries deleted before 'dtime'.
Actions:
  --inode ino            Show info on inode 'ino'.
  --block blk            Show info on block 'blk'.
  --restore-inode ino[,ino,...]
                         Restore the file(s) with known inode number 'ino'.
                         The restored files are created in ./RECOVERED_FILES
                         with their inode number as extension (ie, file.12345).
  --restore-file 'path'  Will restore file 'path'. 'path' is relative to root
                         of the partition and does not start with a '/'
                         The restored file is created in the current
                         directory as 'RECOVERED_FILES/path'.
  --restore-files 'path' Will restore files which are listed in the file 'path'.
                         Each filename should be in the same format as an option
                         to --restore-file, and there should be one per line.
  --restore-directory 'path'
                         Will restore directory 'path'. 'path' is relative to the
                         root directory of the file system.  The restored
                         directory is created in the output directory as 'path'.
  --restore-all          Attempts to restore everything.
  -j journal             Reads an external journal from the named file.
  -b blocknumber         Uses the backup superblock at blocknumber when opening
                         the file system.
  -B blocksize           Uses blocksize as the block size when opening the file
                         system.  The number should be the number of bytes.
  --log 0                Make the program silent.
  --log filename         Logs all messages to filename.
--log D1=0,D2=filename   Custom control of log messages with comma-separated
   Examples below:       list of options.  Dn must be one of info, warn, or
   --log info,error      error.  Omission of the '=name' results in messages
   --log warn=0          with the specified level to be logged to the console.
   --log error=filename  If the parameter is '=0', logging for the specified
                         level will be turned off.  If the parameter is
                         '=filename', messages with that level will be written
                         to filename.
   -o directory          Save the recovered files to the named directory.
                         The restored files are created in a directory
                         named 'RECOVERED_FILES/' by default.
extundelete: Error parsing command-line options.
[root@test extundelete-0.2.4]# pwd
/root/reco/extundelete-0.2.4
[root@test extundelete-0.2.4]# cd /root
[root@test ~]# mkdir 20210616
[root@test ~]# cd 20210616/
[root@test 20210616]# pwd
/root/20210616
[root@test 20210616]# pwd
/root/20210616
[root@test 20210616]# cd /app/apche/
[root@test apche]# ll
总用量 8
drwxrwxr-x 3 weblogic weblogic 4096 6月  16 11:19 zhihui
drwxrwxr-x 5 weblogic weblogic 4096 6月   9 09:32 zhihuimanager
[root@test apche]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       85G   33G   48G  41% /
tmpfs                  16G   72K   16G   1% /dev/shm
/dev/sda1             477M   34M  419M   8% /boot
/dev/mapper/VolGroup-lv_app
                      896G  260G  591G  31% /app
[root@test app]# lvs
  LV      VG       Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_app  VolGroup -wi-ao---- 909.99g                                                    
  lv_root VolGroup -wi-ao----  85.57g                                                    
  lv_swap VolGroup -wi-ao----   3.94g                                                    
[root@test app]# lvdisplay|grep lv_app
  LV Path                /dev/VolGroup/lv_app
  LV Name                lv_app
[root@test app]# cd /root
[root@test ~]# cd 20210616/
[root@test 20210616]# pwd
/root/20210616
[root@test 20210616]# extundelete /dev/VolGroup/lv_app --restore-directory /app/apche/data
NOTICE: Extended attributes are not restored.
WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set.
The partition should be unmounted to undelete any files without further data loss.
If the partition is not currently mounted, this message indicates 
it was improperly unmounted, and you should run fsck before continuing.
If you decide to continue, extundelete may overwrite some of the deleted
files and make recovering those files impossible.  You should unmount the
file system and check it with fsck before using extundelete.
Would you like to continue? (y/n) 
n

相关参考:https://blog.51cto.com/u_10316297/2104586

https://www.xifenfei.com/?s=extundelete

标签:ext4,--,0.2,extundelete,误删,12,test,root
来源: https://blog.csdn.net/jycjyc/article/details/117954399