MENU

Catalog

    Linux 数据恢复工具 - extundelete

    January 1, 2018 • Read: 4194 • 17年实战

    环境: Centos7 ext4 分区 逻辑卷,挂载点 / data

    我们知道 windows 下可以使用 DiskGenius 之类的软件恢复磁盘上记录的数据,linux 有没有这类工具呢?
    今天介绍的 extundelete 支持 ext3、ext4 文件系统误删后的数据恢复。

    通过 rm -rf /data 我将数据库的 data 目录内容全部删除

    恢复步骤:

    1. 首先卸载分区
    #df -h
    #看看挂载的分区结构
    
    umount /data 
    #卸载逻辑卷
    

    安装 extundelete

    wget http://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
    yum install bzip2 e2fsprogs-devel  tar -y
    tar jxvf extundelete*bz2
    cd extundelete-0.2.4
    ./configure --prefix=/usr/local/delete
    make &&make install
    ln -s /usr/local/delete/bin/extundelete /usr/local/bin
    #编译安装,设置快捷方式
    

    使用参数

    extundelete /dev/sdX  --restore-all
    #恢复这个分区所有误删文件
    
    /dev/sdx --restore-file del1.txt 
    #指定恢复文件
    extundelete /dev/sdx --restore-directory  /backupdate/delete
    #指定恢复目录
    

    注意要先 umount 分区在进行恢复操作,可以通过 df -h , fdisk 等命令查目录在哪个挂载分区,我的在 / dev/mapper/Logos-lv_data 逻辑卷上

    extundelete /dev/mapper/Logos-lv_data --restore-directory  mysql
    
    NOTICE: Extended attributes are not restored.
    Loading filesystem metadata ... 152 groups loaded.
    Loading journal descriptors ... 23523 descriptors loaded.
    Searching for recoverable inodes in directory mysql ...
    22 recoverable inodes found.
    Looking through the directory structure for deleted files ...
    21 recoverable inodes still lost.
    

    运行后文件保存在当前 RECOVERED_FILES 目录下。

    du -sh *
    

    49M file.12
    80M file.13
    344K file.14
    32M file.16
    32M mysql

    上面几个是压缩包,mysql 存放数据的目录里面

    兼总条贯 知至知终

    无标签
    最后编辑于: April 2, 2018