Fast HDD or FLASH cloning in linux

written by Admin


Posted on 2013-02-19


Problem

What about a fast cloning method for a compact flash/usb memory/external or internal hard-disk drive using a single linux shell command?

Solution

Don't simply use:
#dd if=/dev/IN_DEVICE of=/dir/file.img

Try instead:
#dd if=/dev/IN_DEVICE bs=1M iflag=direct | dd of=/dir/file.img bs=1M oflag=direct


It is remarcably faster because:

- using two processes, reading and writing are asyncronous,
- using large block transfers you can reach the maximum throughput,
- the direct I/O may speed up the process a lot if you are using a fast machine,
- you can also rise your drive readahead:
#blockdev --setra 1024 /dev/IN_DEVICE

Use, in another shell:
#watch -n 10 killall -USR1 dd
...to watch progess.

Feedback


Leave a Comment:


Search

Categories

android x 1
apache x 1
apple x 4
backup x 2
cygwin x 1
dns x 1
dos x 1
drupal x 3
ftp x 1
iis x 1
imap x 1
linux x 22
mail x 4
mysql x 3
oracle x 1
pop3 x 1
print x 2
proxy x 1
rsync x 1
shell x 8
smtp x 1
squid x 1
ssh x 1
storage x 2
web x 3
windows x 15

Welcome

We need collaboration and a real boost from our community: write us an email for every trick you find!

This website is a sysadmin swiss-knife for every-day Windows, Linux and Mac administration and troubleshooting

Our database grows if YOU send us your tips and trick as soon as you find them every day!