dd if=/dev/ada0 of=/dev/ada1 bs=1m conv=noerror
rolfheinrich said:If you are really looking for cloning the complete disk, including all partitions, then dump/restore is perhaps not the best option. It is somewhat slow, and as wblock pointed out, you have to take care for each partition and the boot block separately.
Quite frequently, I use dd(1)() to clone my system disk to another hdd of the same model. This produces an exact clone, including partitions and its labels.
dd if=/dev/ada0 of=/dev/ada1 bs=1m conv=noerror
wblock@ said:
# mount -o async /dev/ada1p3 /mnt; cd /mnt
# dump -C 24 -0af - /dev/ada0p3 | restore -rf -
1926 root 1 58 0 4324K 2256K piperd 1 0:06 18.90% restore
1927 root 1 57 0 28004K 7008K sbwait 3 0:05 17.48% dump
1928 root 1 49 0 27876K 26044K physrd 3 0:02 8.50% dump
1929 root 1 49 0 27876K 26044K physrd 1 0:02 8.40% dump
1930 root 1 49 0 27876K 26044K physrd 1 0:02 8.15% dump
wblock@ said:2. noerror means "if there is an error during the copy, no big deal, just fill it with zeros and keep going". Do not use noerror unless the copy is from a failing hard drive.
noerror Do not stop processing on an input error. When an
input error occurs, a diagnostic message followed by
the current input and output block counts will be writâ€
ten to the standard error output in the same format as
the standard completion message. If the sync ...
rolfheinrich said:dump(8)/restore(8) doesn't even remotely come close to a transfer rate of 70 MByte/s. A recent experiment with the same disks gave 15 MByte/s, and at the same time the processor utilization was quite high.
# mount -o async /dev/ada1p3 /mnt; cd /mnt
# dump -C 24 -0af - /dev/ada0p3 | restore -rf -
The relevant section of dd(1)() tells:
Code:noerror Do not stop processing on an input error. When an input error occurs, a diagnostic message followed by the current input and output block counts will be writ†ten to the standard error output in the same format as the standard completion message. If the sync ...
This seems to be exactly what I want/need on disk cloning, i.e., on error don't stop, but continue and drop an error message. If there would be an error, then I want dd to rescue as much of the data as possible. After cheking the error log, I could put that cloned disk safely aside, and try again to get a whole clone using recoverdisk(1)() onto a new disk.
dd if=/dev/targetdrive of=/dev/backupdrive bs=1m conv=noerror
dd if=/dev/backupdrive of=/dev/targetdrive bs=1m conv=noerror
wblock@ said:... It must be MBR, not GPT. ...
rolfheinrich said:Are you sure?
I used dd for cloning GPT disks. The partitions are cloned exactly, and I can access the whole file structure on all the partitions. I have to admit that I did not try to restart from the clone. Is there something, that I need to be worried about?
wblock@ said:Backup GPT partition tables have to be at the end of the disk, not the before. If the disks aren't identical in size, one will have an incorrect backup GPT.
gpw928 said:Having said that, I have not used dump for many years. These days my backups go to disk (both local and remote) using rsync. It's *much* faster because once the initial copy is in place, only the changes need be backed up.
#!/usr/local/bin/bash
time dump -1 -a -L -f - / | ( cd /mnt/root ; restore ruvf - )
time dump -1 -a -L -f - /var | ( cd /mnt/var ; restore ruvf - )
time dump -1 -a -L -f - /tmp | ( cd /mnt/tmp ; restore ruvf - )
time dump -1 -a -L -f - /usr | ( cd /mnt/usr ; restore ruvf - )