tencent cloud

Feedback

Recovering Data on Linux CVMs

Last updated: 2024-01-06 17:43:10

    Overview

    This document uses a CVM instance on CentOS 8.0 as an example to describe how to use the open-source tool Extundelete to recover accidentally deleted data. Extundelete can recover accidentally deleted files in EXT3 and EXT4 file systems, but the specific level of recovery is subject to various factors such as whether files are overwritten by writes after deletion and whether metadata is stored in the journal. If the file system to be recovered is on the system disk, and there are always business or system processes writing files, the possibility of recovery is low.
    Note:
    Tencent Cloud also offers snapshots, custom images and Cloud Object Storage to store data. We recommend that you regularly back up data to enhance data security.

    Preparations

    Before recovering the data, complete the following preparations:
    Back up your data by referring to Creating Snapshots and Creating Custom Images.
    Stop writing data to the file system. If you need to recover a data disk, run umount to detach the disk from the CVM instance first.

    Directions

    1. Install Extundelete in the following two ways:
    Download (recommended)
    Manual set-up
    1. Run the following command to directly download the compiled binary program.
    wget https://github.com/curu/extundelete/releases/download/v1.0/extundelete
    2. Run the following command to grant file permissions.
    chmod a+x extundelete
    Note:
    The steps below are for CentOS 7 as an example. Note that the steps vary by the operating system.
    1. Run the following command to install the Extundelete dependencies and libraries.
    yum install libcom_err e2fsprogs-devel
    yum install gcc gcc-c++
    2. Run the following command to download the Extundelete source code.
    wget https://github.com/curu/extundelete/archive/refs/tags/v1.0.tar.gz
    3. Run the following command to decompress the v1.0.tar.gz file.
    tar xf v1.0.tar.gz
    4. Run the following commands in sequence to compile and install.
    cd extundelete-1.0
    ./configure
    make
    5. Run the following command to enter the src directory to view the compiled Extundelete file.
    cd ./src
    2. Run the following command to try recovering the data.
    ./extundelete --restore-all /dev/corresponding disk
    The recovered files are located in the RECOVERED_FILES folder at the same directory level. Check whether there are the needed files.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support