700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > testdisk 恢复文件_如何在Linux上安装TestDisk并恢复已删除的文件

testdisk 恢复文件_如何在Linux上安装TestDisk并恢复已删除的文件

时间:2023-03-24 10:13:20

相关推荐

testdisk 恢复文件_如何在Linux上安装TestDisk并恢复已删除的文件

testdisk 恢复文件

Ever stuck in a situation where you accidentally deleted a file? In this tutorial, we’ll go over how to install TestDisk in Linux and recover deleted files.

是否曾经遇到过意外删除文件的情况? 在本教程中,我们将介绍如何在Linux中安装TestDisk以及恢复已删除的文件。

In this tutorial, I’ll be using an Ubuntu server to work with, but even if you are on any other distribution, you can follow the same steps. The only thing that will be different is the package manager used for installation.

在本教程中,我将使用Ubuntu服务器进行工作,但是即使您使用任何其他发行版,也可以按照相同的步骤进行操作。 唯一不同的是用于安装的程序包管理器。

在Linux上安装TestDisk (Install TestDisk on Linux )

Thetestdiskpackage is available on all the major Linux distributions and can be easily downloaded with the use of the default package manager. Here, I’ve listed down the distro-specific commands to install testdisk on Linux.

testdisk软件包在所有主要的Linux发行版中都可用,并且可以使用默认的软件包管理器轻松下载。 在这里,我列出了在Linux上安装testdisk的特定于发行版的命令。

Install TestDisk on Ubuntu/Debian

在Ubuntu / Debian上安装TestDisk

sudo apt update sudo apt -y install testdisk

We’re using the apt package manager instead of the apt-get since that’s the new package manager for Ubuntu/Debian.

我们使用apt软件包管理器而不是apt-get,因为这是Ubuntu / Debian的新软件包管理器。

Install TestDisk on Red Hat and CentOS 7

在Red Hat和CentOS 7上安装TestDisk

yum install epel-releaseyum updateyum install testdisk

Install TestDisk on Red Hat and CentOS 8

在Red Hat和CentOS 8上安装TestDisk

yum install /pub/epel/epel-release-latest-8.noarch.rpmyum updateyum install testdisk

You need to also enable/install the EPEL repository. The EPEL repository is an additional package repository that provides easy access to install packages for commonly used software.

您还需要启用/安装EPEL存储库。 EPEL存储库是一个附加的软件包存储库,可轻松访问常用软件的安装软件包。

To know more about the EPEL repository, visit the official page.

要了解有关EPEL存储库的更多信息,请访问官方页面 。

Install TestDisk on Arch Linux

在Arch Linux上安装TestDisk

sudo pacman -S testdisk

Install TestDisk on Fedora

在Fedora上安装TestDisk

sudo dnf install testdisk

如何在Linux中恢复已删除的文件? (How To Recover Deleted Files in Linux?)

Now that you have the testdisk utility installed, it’s time to use it to recover our deleted files or partitions.

现在您已经安装了testdisk实用程序,是时候使用它来恢复我们已删除的文件或分区了。

Testdisk works with the following partition types:

Testdisk使用以下分区类型:

Partition Types Testdisk Works With
分区类型Testdisk适用

You might not need to check for the partition type as the above list covers almost all the major partition types. But if you’re unsure, enter one of the commands:

您可能不需要检查分区类型,因为上面的列表涵盖了几乎所有主要分区类型。 但是,如果不确定,请输入以下命令之一:

stat -f <partition>df -Tfdisk -l

Fdisk L
软盘

Either of the commands above will give you the filesystem type information.

上面的任何一个命令都会为您提供文件系统类型信息。

1.启动TestDisk并配置其运行位置 (1. Starting TestDisk and Configuring Where it Runs)

In your terminal, simply enter the commandtestdiskto run the utility and you’ll be greeted with the below prompt. You can select the appropriate disk drive that you want to recover files on.

在您的终端中,只需输入命令testdisk即可运行该实用程序,然后会出现以下提示。 您可以选择要在其上恢复文件的适当磁盘驱动器。

Testdisk Welcome Screen Log
Testdisk欢迎屏幕日志

If its the first time you’re running this utility, it will give you an option to create a log file on the welcome screen. You can select create and just move ahead with the defaults.

如果是第一次运行此实用程序,它将为您提供一个在欢迎屏幕上创建日志文件的选项。 您可以选择创建,然后继续使用默认设置。

The next screen asks you to select the disk drive/partition:

下一个屏幕要求您选择磁盘驱动器/分区:

Test Disk Partition Select
测试磁盘分区选择

2.选择和分析分区 (2. Selecting and Analyzing the Partition)

Once you’ve selected the right partition, you will be asked to select the partition type.

选择正确的分区后,将要求您选择分区类型。

Testdisk Partition Type Selection Screen
测试磁盘分区类型选择屏幕

It should auto-select the correct partition type, but if it doesn’t, make sure you select the correct type.

它应该自动选择正确的分区类型,但是如果没有,请确保选择正确的类型。

Once that’s done, you’ll be given a menu of options out of which we need to go ahead with “Analyse” to search for lost data.

完成后,将为您提供选项菜单,我们需要从其中进行“分析”以搜索丢失的数据。

Test Disk Analyse Partitions
测试磁盘分析分区

You can go with “Quick Search” or “Deeper Search” as it fits your needs and let the search run until it has scanned all the inodes.

您可以根据需要选择“快速搜索”或“深度搜索”,然后运行搜索直到扫描完所有inode。

Testdisk Analyse Screen
测试盘分析屏幕

3.扫描分区中已删除的文件 (3. Scanning the Partition for Deleted Files)

With the option selected, you’ll be greeted with which specific partition you want to scan.

选择该选项后,您将看到要扫描的特定分区。

Analyze Specific Partitions
分析特定分区

Select the correct partition, and let the utility scan the entire drive. Within some time, you’ll get the list of files within the partition. When the scanning is in progress, you’ll see a screen similar to the one below.

选择正确的分区,然后让实用程序扫描整个驱动器。 在一段时间内,您将获得分区内文件的列表。 进行扫描时,您会看到类似以下的屏幕。

Testdisk Working
测试盘工作

Now once the progress is completed, it provides you with the option to select the partition that you want to browse the files in. All the files that are highlighted in “red” or any color or text style (can also be influenced by terminal configuration) are the files that have been recovered by the TestDisk utility.

现在,完成进度后,它为您提供了选择要浏览文件的分区的选项。所有以“红色”或任何颜色或文本样式突出显示的文件(也可能会受到终端配置的影响) )是TestDisk实用程序已恢复的文件。

To restore those files, simply press the letter"C"and it will allow you to copy that file and paste it in some other directory that you want to restore it to.

要还原这些文件,只需按字母"C",它将允许您复制该文件并将其粘贴到要将其还原到的其他目录中。

结论 (Conclusion)

Well, there you have it. You’ve learned how to recover deleted files in Linux! Go ahead and explore this utility more on a virtual machine to get a hang of it before using it in real-life situations so you know exactly how to work with it on an advanced scale.

好吧,那里有。 您已经了解了如何在Linux中恢复已删除的文件! 在实际环境中使用它之前,请继续在虚拟机上对其进行更多探索,以了解它的原理,以便您确切了解如何大规模使用它。

We hope you’ve understood the use of the testdisk utility in Linux and know how to use it now. If you have any questions, let us know in the comments below.

我们希望您已经了解了Linux中testdisk实用程序的用法,并且知道如何立即使用它。 如果您有任何疑问,请在下面的评论中告诉我们。

翻译自: /36700/how-to-install-testdisk-on-linux-and-recover-deleted-files

testdisk 恢复文件

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。