
ddrescue
ddrescue is a GNU provided data recovery tool.It can copy and recover file, directory or whole hard drive. The best part of the ddrescue
is it can prevent or solve read errors.
ddrescue是GNU提供的数据恢复工具,它可以复制和恢复文件,目录或整个硬盘驱动器。 ddrescue
最好的部分是它可以防止或解决读取错误。
为Ubuntu,Debian,Kali和Mint安装 (Install For Ubuntu, Debian, Kali and Mint)
We can install ddrescue
tool for deb
based distributions like below. ddrescue
command is provided with package name gddrescue
.
我们可以为基于deb
的发行版安装ddrescue
工具,如下所示。 ddrescue
命令与软件包名称gddrescue
。
$ sudo apt install gddrescue

列出硬盘(List Hard Drives)
Before rescuing or copying files and directories we generally need to list hard drives so we will be sure that which is the source and which is the destination drive with its path. We will list drives with fdisk
command.
在抢救或复制文件和目录之前,我们通常需要列出硬盘驱动器,以便我们确定哪个是源驱动器,哪个是目标驱动器及其路径。 我们将使用fdisk
命令列出驱动器。
$ sudo fdisk -l

复制单个文件(Copy Single File)
We will start with a simple copying file example we will copy file named Data
. This option do not needs any option.
我们将从一个简单的复制文件示例开始,我们将复制名为Data
文件。 此选项不需要任何选项。
$ ddrescue Data /home/ismail/backup/Data

As we can see there is a lot of information about the single file copy and rescue operation. One of the most important output is that the Finished
which means it is successfully finished copying file.
如我们所见,有很多关于单文件复制和救援操作的信息。 最重要的输出之一是Finished
,这意味着它已成功完成复制文件。
复制单个目录 (Copy Single Directory)
We can also copy a directory with the same syntax as file. We will copy directory named backup to the /mnt/
where we have mounted our tape.
我们还可以使用与文件相同的语法复制目录。 我们会将名为backup的目录复制到安装磁带的/mnt/
中。
$ ddrescue backup /mnt/backup
将日志保存到文件 (Save Log to File)
During the copy and backup operation some logs are created for troubleshoot or review. By default these logs are not created but we can save these logs into a file. We will add the log file path and name after source and destination. In this example we will write log file current working directory as ddrescu.log
name.
在复制和备份操作期间,将创建一些日志以进行故障排除或查看。 默认情况下,不会创建这些日志,但是我们可以将这些日志保存到文件中。 我们将在源和目标之后添加日志文件的路径和名称。 在此示例中,我们将日志文件当前工作目录写为ddrescu.log
名称。
$ ddrescue Data /home/ismail/backup/Data ddrescue.log

设置最大读取速率或速度(Set Maximum Read Rate or Speed)
While copying or backup we may need to set some maximumu for read operating because of the operational issues. We can set maximum speed for read operation from source. We will use -Z
or --max-read-rate=
. In this example we will set 10 megabyte.
在复制或备份时,由于操作问题,我们可能需要为读取操作设置一些最大值。 我们可以设置从源读取操作的最大速度。 我们将使用-Z
或--max-read-rate=
。 在此示例中,我们将设置10 MB。
$ ddrescue -Z 10M Data /home/ismail/backup/Data
ddrescue