亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Home Computer Tutorials Computer Knowledge Use ddrescue to recover data on Linux

Use ddrescue to recover data on Linux

Mar 20, 2024 pm 01:37 PM
tool data reply

DDREASE is a tool for recovering data from file or block devices such as hard drives, SSDs, RAM disks, CDs, DVDs and USB storage devices. It copies data from one block device to another, leaving corrupted data blocks behind and moving only good data blocks. ddreasue is a powerful recovery tool that is fully automated as it does not require any interference during recovery operations. Additionally, thanks to the ddasue map file, it can be stopped and resumed at any time. Other main functions of DDREASE are as follows:

  • It will not overwrite the recovered data but will fill in the gaps in case of iterative recovery. However, it can be truncated if the tool is instructed to do so explicitly.
  • Recover data from multiple files or blocks to a single file.
  • Supports multiple types of device interfaces, such as SATA, ATA, SCSI, MFM drives, floppy disks and SD cards.

In this guide, I will take an in-depth look at this powerful data recovery tool, discussing its installation steps and how to use it to recover block devices or partitions.

  • Install ddrescue
  • Understand the basics
  • Important considerations
  • Use DDREASE
  • Repair corrupted blocks
  • Restore image file to new blocks
  • Restore data block to another data block
  • Recover specific data from saved image files
  • Advanced Features
  • How ddrescue works
  • in conclusion

Please note: In this guide, I am using a Linux distribution (Ubuntu 22.04). The installation steps for the Ddreasure utility may vary depending on the distribution, but the guidelines are universal for all Linux distributions.

Install ddrescue

To install ddrescue on Linux, especially Ubuntu and its versions or Debian-based distributions, use: Purpose:

sudo apt install gddrescue

To install it on REHL, Fedora and CentOS, first enable ETEL (Extra Packages for Enterprise Linux).

sudo yum install epel—release

The above commands are applicable to newer versions of the respective distributions.

Then execute the following command to install ddreasue:

sudo yum install ddrescue

For Arch-Linux based distributions like Arch-Linux and Manjaro, please install the ddrescue recovery utility using the command given below.

sudo pacman—S ddrescue

Since I am using Ubuntu 22.04, I will use the APT package manager to install it.

Understand the basics

Before using the ddreasue tool to recover data, I recommend that users who are not familiar with the recovery process understand some naming conventions of Linux.

Linux recognizes blocks (devices) as files and places them in the /dev directory. To list the files in the /dev directory, use the ls/dev command.

Hard drives (storage blocks) are represented by sd and the alphabet; in the case of multiple storage devices, the files will be represented as /dev/sda, /dev/sdb, etc.

If the storage device has partitions, they will be represented by numbers with corresponding drive file names, such as /dev/sda1, /dev/sda2, etc.

To list all blocks and other connected devices in the system, use the list block lsblk command:

lsblk

Use ddrescue to recover data on Linux

ddrescue command can recover the entire block (including MBR and partition) or partition. On the other hand, if you only need to recover specific files from a specific partition, then it is better to recover the partition rather than the entire block.

Important considerations

Before using the ddue utility, there are some very critical issues that should be considered:

  • Do not attempt to recover a mounted data block, which should not even be in read-only mode.
  • Do not attempt to repair a data block with an I/O error.
  • The system can change input and output device names on reboot. Before starting the copy process, make sure the device name is correct.
  • If you use a separate block as the output device, all data on the device will be overwritten.

Use ddrescue

After installing the ddrescue utility and understanding the naming convention, the next step is to identify the failed disk and use the ddrescue tool to recover it.

Repair corrupted blocks

The first example will contain the process of recovering the entire block. First, list the blocks using the lsblk command:

lsblk—o Name, Size, FSTYPE

—The o flag is used to specify what type of information (field) the command should output. I have mentioned name, size and FSTYPE or file system type.

Use ddrescue to recover data on Linux

Now you can determine the target block, partition and location to save the rescued image file.

Another important thing to note is that on Linux, block names are dynamically assigned at boot time and after a reboot, the name of the block may change. So, be careful when writing down block names.

Now, use the syntax below to save the chunk as an image file and use the log file in the root directory.

sudo ddrescue—d—rX/dev/[block][path/name]. img [logfile_name]. log

Note: Replace [block], [path/name] and [logfile_name] of the image file with the preferred name accordingly.

In this example, I am recovering /dev/sda in the root directory using the image file name recovery.img. Log files (also called map files) are necessary if recovery is to be resumed at any time.

Sudo dd rescue-d-r2/dev/sda2 restore.img restore.log

Two important flags are used in the above command.

D -indirect Used to tell the tool to access the disk directly and ignore the kernel cache
RX -Retry-Pass Used to tell the tool to retry bad sectors X times

When executing the above command, you will notice that two files appear in the file browser, named recovery.img and recovery.log.

Use ddrescue to recover data on Linux

Recovery time depends on input block size and corruption. If you want to recover large data blocks, I recommend using log files, as the process can take hours or even days to complete.

The output of the above command is as follows:

Use ddrescue to recover data on Linux

In the output image, ipos is the input location of the input file from which copying starts, and opos is the output location of the data written on the output file.

Non-try is the size of the block without waiting for a try. Rescued represents the size of successfully recovered blocks. Rescued pct indicates the percentage of data successfully recovered. The terms, non-pruned, non-scrap, bad sectors and bad areas are self-explanatory. However, read error terms represent failed read attempts numerically.

The running time shows the time it took the tool to complete the process, while the remaining time is the time remaining to complete the recovery process. The above output shows that the remaining time is 0 because the process has completed, please read the output below in the image of the unfinished process.

Use ddrescue to recover data on Linux

Let's see what we get in the log file; to open the generated log file, use the vim recovery.log command.

Use ddrescue to recover data on Linux

current_status is , indicating the end of the process, and current_pos is the position on the block.

The current status list is shown in the table below:

? copy
* prune
/ scrapped
Retry
F Fill the specified block
G Generate log file
The process is completed

Below this, the log file shows the status of previously rescued chunks in the characters listed below:

? Block Not Tried
* Unpruned faulty block
/ Unretired invalid blocks
Bad sector failed data block
Complete Block

Restore image file to new blocks

Once you have completed the recovery process and have the image file. You may now want to move it from the damaged drive to the new drive. To move an image file to a new block, first, connect the block to the system and then use the lsblk command to identify the block name.

Assuming it is /dev/sdb, use the following command to copy the image to a new block.

sudo ddrescue—f recovery. img/dev/sdb logfile.log

If there is any data, use the -f flag to overwrite the new block. Remember that the log file must have a different name to keep it separate from previously stored log files.

The above operation can also be done using dd, which is another powerful command for copying files.

sudo dd if = recovery. img of =/dev/sdb

Before proceeding with the restore, please remember that the new block must be large enough to preserve the entire recovered block; for example, if the recovery block is 5GB, the new block should be larger than 5GB.

If the recovered image file presents a lot of errors, then they can be repaired to an extent using the fsck command on Linux. On Windows you can use the CHKDSK or SFC command to do this. However, recovery depends on the number of errors generated by the corrupted file.

Now, the recovery process and repair work is complete. Another important thing to note is that instead of creating an image file and then copying it to the new block, you can recover the corrupted block directly on another block. Okay, in the next section I'll go into detail about this process.

Restore data block to another data block

To restore a block directly to a new block, first connect the block to the system and then use the lsblk command again to identify the block name. Wrong block names can disrupt the entire process and you may lose data.

After the source and destination blocks are identified, restore the block using the following command:

sudo ddrescue—d—f—r2/dev/[source]/dev/[destination] backup.log

Assuming /dev/sdb is the target block, so to copy the /dev/sda directory to the new block, use use:

Sudo ddue-d-f-r2/dev/sda/dev/sdb backup.log

Before attempting this procedure, please see the key considerations mentioned in the previous sections.

Recover specific data from saved image files

In many cases, the purpose of data recovery is to find specific files from a damaged drive. To access specific files, you need to mount the image file. On Linux, the recovered image file can be explored using the mount command.

Before mounting the image file, create a folder or directory where the contents of the image file will be extracted.

mkdir Recovery Mount

Next, use the following command to mount the image file:

sudo mount—o loop recovery. img~/Recovery Mount

The

—o flag indicates options, and the loop option is used to treat the image file as a block device.

You can now access the contents of the image file, as shown in the screenshot below.

Use ddrescue to recover data on Linux

To unmount a block, use the umount command.

SUDO uninstall~/restore load

Advanced Features

To resume from a specific point, use the -i flag or -input-position. It should be in bytes and defaults to 0 bytes. It is important to resume replication from a specific point. For example, if you want to start the copy process from the 10 GB point, use the following command.

sudo ddrescue—i10GiB/dev/sda imagefile. img logfile.log

To define the maximum size of the input device, the -s flag will be used. -s indicates size, which can also be used as -size, in bytes. If the tool does not recognize the size of the input file, use this option to specify it.

Sudo ddreasure-s10GiB/dev/sda Imagefile.imglog file.log

—The ask option is very convenient as it prompts for confirmation of input and output blocks before starting the copy process. As mentioned before, the system dynamically assigns names to blocks and changes the names on reboot. In this case, this option may be useful.

sudo ddrescue——ask/dev/sda imagefile. img logfile.log

Additionally, some other alternatives are listed below:

—R —Reverse Reverse the direction of copy
—q -quite Cancel all output messages
—V -lengthy In more detail, all output messages
—p -Preallocation Pre-allocate storage space for output files
—P -Data preview The display lines of the latest read data default to 3 lines

How ddrescue works

DDREASE uses a powerful recovery algorithm, which is divided into four stages:

1.Copy

2.Pruning

3.Scrape

4.Retry

The execution of the ddrescue algorithm is shown in the figure below.

Use ddrescue to recover data on Linux

in conclusion

ddrescue is a powerful recovery tool for recovering data from a damaged or faulty drive by copying it to another drive. It can be installed effortlessly on any Linux distribution with the help of the default package manager. Please note important considerations before using this tool mentioned in this guide. The process of copying data is simple, unmount the drive and use ddrescue command with source drive name and destination drive name. Don't forget to use the log file as it becomes very useful during the recovery process.

The above is the detailed content of Use ddrescue to recover data on Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to check the main trends of beginners in the currency circle How to check the main trends of beginners in the currency circle Jul 31, 2025 pm 09:45 PM

Identifying the trend of the main capital can significantly improve the quality of investment decisions. Its core value lies in trend prediction, support/pressure position verification and sector rotation precursor; 1. Track the net inflow direction, trading ratio imbalance and market price order cluster through large-scale transaction data; 2. Use the on-chain giant whale address to analyze position changes, exchange inflows and position costs; 3. Capture derivative market signals such as futures open contracts, long-short position ratios and liquidated risk zones; in actual combat, trends are confirmed according to the four-step method: technical resonance, exchange flow, derivative indicators and market sentiment extreme value; the main force often adopts a three-step harvesting strategy: sweeping and manufacturing FOMO, KOL collaboratively shouting orders, and short-selling backhand shorting; novices should take risk aversion actions: when the main force's net outflow exceeds $15 million, reduce positions by 50%, and large-scale selling orders

Ethereum ETH latest price APP ETH latest price trend chart analysis software Ethereum ETH latest price APP ETH latest price trend chart analysis software Jul 31, 2025 pm 10:27 PM

1. Download and install the application through the official recommended channel to ensure safety; 2. Access the designated download address to complete the file acquisition; 3. Ignore the device safety reminder and complete the installation as prompts; 4. You can refer to the data of mainstream platforms such as Huobi HTX and Ouyi OK for market comparison; the APP provides real-time market tracking, professional charting tools, price warning and market information aggregation functions; when analyzing trends, long-term trend judgment, technical indicator application, trading volume changes and fundamental information; when choosing software, you should pay attention to data authority, interface friendliness and comprehensive functions to improve analysis efficiency and decision-making accuracy.

BTC digital currency account registration tutorial: Complete account opening in three steps BTC digital currency account registration tutorial: Complete account opening in three steps Jul 31, 2025 pm 10:42 PM

First, select well-known platforms such as Binance Binance or Ouyi OKX, and prepare your email and mobile phone number; 1. Visit the official website of the platform and click to register, enter your email or mobile phone number and set a high-strength password; 2. Submit information after agreeing to the terms of service, and complete account activation through the email or mobile phone verification code; 3. After logging in, complete identity authentication (KYC), enable secondary verification (2FA), and regularly check security settings to ensure account security. After completing the above steps, you can successfully create a BTC digital currency account.

What are the websites for real-time price query of Bitcoin? Recommended websites that can view Bitcoin K-line and depth chart What are the websites for real-time price query of Bitcoin? Recommended websites that can view Bitcoin K-line and depth chart Jul 31, 2025 pm 10:54 PM

In the digital currency market, real-time mastering of Bitcoin prices and transaction in-depth information is a must-have skill for every investor. Viewing accurate K-line charts and depth charts can help judge the power of buying and selling, capture market changes, and improve the scientific nature of investment decisions.

btc trading platform latest version app download 5.0.5 btc trading platform official website APP download link btc trading platform latest version app download 5.0.5 btc trading platform official website APP download link Aug 01, 2025 pm 11:30 PM

1. First, ensure that the device network is stable and has sufficient storage space; 2. Download it through the official download address [adid]fbd7939d674997cdb4692d34de8633c4[/adid]; 3. Complete the installation according to the device prompts, and the official channel is safe and reliable; 4. After the installation is completed, you can experience professional trading services comparable to HTX and Ouyi platforms; the new version 5.0.5 feature highlights include: 1. Optimize the user interface, and the operation is more intuitive and convenient; 2. Improve transaction performance and reduce delays and slippages; 3. Enhance security protection and adopt advanced encryption technology; 4. Add a variety of new technical analysis chart tools; pay attention to: 1. Properly keep the account password to avoid logging in on public devices; 2.

Why does Binance account registration fail? Causes and solutions Why does Binance account registration fail? Causes and solutions Jul 31, 2025 pm 07:09 PM

The failure to register a Binance account is mainly caused by regional IP blockade, network abnormalities, KYC authentication failure, account duplication, device compatibility issues and system maintenance. 1. Use unrestricted regional nodes to ensure network stability; 2. Submit clear and complete certificate information and match nationality; 3. Register with unbound email address; 4. Clean the browser cache or replace the device; 5. Avoid maintenance periods and pay attention to the official announcement; 6. After registration, you can immediately enable 2FA, address whitelist and anti-phishing code, which can complete registration within 10 minutes and improve security by more than 90%, and finally build a compliance and security closed loop.

Stablecoin purchasing channel broad spot Stablecoin purchasing channel broad spot Jul 31, 2025 pm 10:30 PM

Binance provides bank transfers, credit cards, P2P and other methods to purchase USDT, USDC and other stablecoins, with fiat currency entrance and high security; 2. Ouyi OKX supports credit cards, bank cards and third-party payment to purchase stablecoins, and provides OTC and P2P transaction services; 3. Sesame Open Gate.io can purchase stablecoins through fiat currency channels and P2P transactions, supporting multiple fiat currency recharges and convenient operation; 4. Huobi provides fiat currency trading area and P2P market to purchase stablecoins, with strict risk control and high-quality customer service; 5. KuCoin supports credit cards and bank transfers to purchase stablecoins, with diverse P2P transactions and friendly interfaces; 6. Kraken supports ACH, SEPA and other bank transfer methods to purchase stablecoins, with high security

USDT virtual currency purchase process USDT transaction detailed complete guide USDT virtual currency purchase process USDT transaction detailed complete guide Aug 01, 2025 pm 11:33 PM

First, choose a reputable trading platform such as Binance, Ouyi, Huobi or Damen Exchange; 1. Register an account and set a strong password; 2. Complete identity verification (KYC) and submit real documents; 3. Select the appropriate merchant to purchase USDT and complete payment through C2C transactions; 4. Enable two-factor identity verification, set a capital password and regularly check account activities to ensure security. The entire process needs to be operated on the official platform to prevent phishing, and finally complete the purchase and security management of USDT.

See all articles