How To Clone a disk with ddrescue in Linux
Here is a workaround which I have recently learned how to clone a bad disk in Linux. I just wanted to share this information with the people over here.
1. Use a Linux LiveCD as SystemRescueCd (or the rescue mode on the installation CD for Linux distribution used) to start the system where the disk is connected to clone.
2. Since the terminal is giving access to Shell, run fdisk -l and identify disk (source and target)
3. Launch
Code:
ddrescue -B -v /dev/XXX /dev/YYY /ZZZ/ddrescue_logfile_AAAA-MM-JJ.log
Where:
XXX = name of the complete source disk (NOT the partition.)
YYY = name of the complete target disk (NOT the partition.)
ZZZ = name of the mount point of a disk or a USB key to contain the file 'log' activities ddrescue (not required for dd).
YYYY = 4-digit year.
MM = month on two day.
DD = 2 digit day.
The option -B is to force the expression of numbers using powers binary (1024 instead of 1000 for Kbytes, etc ...)
The -v option is to force ddrescue to be "wordy"(we know about what happens)
When finished, the disk is cloned!
If another 'LiveCD' is used, you may only have to use dd (and not ddrescue). The command line would be:
Code:
dd if=/dev/XXX of=/dev/YYY -BS=16M
The option -BS=16M forces the use of data blocks of 16 MB when the phases of read/write data dd. On the other hand, dd says nothing about what he does so before completing, ddrescue is preferable if disk cloning with "bad sectors" ...
The difference between dd and ddrescue is that it can attempt recovery of bad sectors the disk to clone. But just try. dd stop at the first reading error and will not search if there is anything else to get.
Re: How To Clone a disk with ddrescue in Linux
ddrescue is intended to be copied without being interrupted by a read error, unlike dd.
We will be careful to think
- If the disk has errors, you should consider replacing it;
- If the errors are errors of file system errors and not block, it is advisable to repair the file system,
- If the target is a file, the disk must contain either the greater good
- If the target is a file, it is likely to take another drive and another dd
- Dd (or ddrescue) does not remedy a disk (filesystem), nor that a copy of the same size.
This is a kind of cloning.
Disk cloning may be deployed from the perspective of a master. And there is free tool partimage (and now on SystemRescueCd clonezilla) who knows just what to copy. In addition, we think of parted or gparted to resize partitions (defragmented prior to ntfs or fat32=vfat).
Re: How To Clone a disk with ddrescue in Linux
You just forgot a few details about how to use ddrescue. The procedure is as follows:
1 - To recover quickly: the -n parameter does not stress when encountering a bad sector
Code:
ddrescue -B -v -n /dev/XXX /dev/YYY /ZZZ/ddrescue_logfile_AAAA-MM-JJ-HHMM.log
I prefer to add time in log file names: easier if we generate more in one day
2 - We did another pass to try to recover the non-read the first pass. Needless course in the absence of bad sectors:
Code:
ddrescue -B -v -c 16 -r 2 /dev/XXX /dev/YYY /ZZZ/ddrescue_logfile_AAAA-MM-JJ-HHMM.log
Be careful to indicate the same .log file, since it is from there that will identify areas to recover. 16 sectors are treated at once (c-16) and retries is 2 (-r 2).
3 - If needed redo a third passage:
Code:
ddrescue -B -v -c 1 -r 5 /dev/XXX /dev/YYY /ZZZ/ddrescue_logfile_AAAA-MM-JJ-HHMM.log
This time, it does only one sector at a time (-c 1) and the emphasis is heavily (5 retries: r-5).
Re: How To Clone a disk with ddrescue in Linux
No, the frequency of writing has nothing to do: ddrescue stores sector by sector that has already been duplicated, and that only explains the size of the log file. Reduce the size, it would mean not only by memorizing clusters, or other group of industries, and suddenly the possibilities of recovery and focus on the bad sectors would be far less accurate which would increase enormously in the time passes by resumed.