Linux Drive Clone Question

By w2ktechman ·
Ok, here is the deal, and I think this would be good to know for all of those looking into learning Linux as well.
Currently at work I have a system (desktop) with 2 IDE based drives, master (OS -- WinXP) and slave (for data recovery, images for testing, etc.). I had an internal drive bay for the second, but I need the storage now.
Anyway, I have started using USB drive bays to recover data. But I just ran into a problem.
On Thursday, I had an ER recovery, and my manager requested the disk to be cloned. No Problem I say because I have done it many times. Usually it will take a few hours. But this time, it is cloning from a USB 2 drive. After an hour (Using Ghost 2003) I noticed that the speed was running at 17MB/Min. That translates to 1020MB/Hr. There is 36 GB on this drive.
Friday morning it was still running, and the user is asking why her system is not ready.
Then, another user comes in with a system that BSOD's on boot. It is easily tracked to the SW reg hive being corrupt. I could not use my machine for another 14 hours so, I setup a new desktop system with XP, 2 Hdd's and Ghost. Borrowed a USB drive bay, and started it. It ran at 112MB/Min.. Great, I thought about taking the first drive and using it on the new system. But after 5 min, it was running at 17MB/min.
Ok, this is too slow, in Windows, it works fast like it should, from the Ghost boot it runs like molasses.

Is there a solution in Linux that can clone a drive to an image file to be extracted on another drive where both the source and destination are a USB drive bay.
And, will it keep Linux open where the USB will work better, or will it close out to the command line or perform like ghost? Later Friday, I had another users drive go out and I had to tell them I could not get to it until Monday.
I was reading a bit on DD, but it looks like it just clones the drive to another, but I did not see anything that said it worked on USB drives, or that it creates a file to be extracted.

Any help would be appreciated, and I do mark as helpful. I just want to get the clone time down to a reasonable time frame. Cause 36+ hours for 36GB is just way too much.

This conversation is currently closed to new comments.

26 total posts (Page 3 of 3)   Prev   01 | 02 | 03
Thread display: Collapse - | Expand +

All Answers

Collapse -

The problem is...

by StephenMollett In reply to That is good to know !

... that they wouldn't be strictly
consistent. While the drive clone from the
live system worked, the filesystems were
not "frozen" so data was changing on the
disk as it was being cloned.

The fact that the cloned copy worked at all
is a testament to the robustness of the
filesystems that were in use.

There is a snapshot function for doing this
properly in Device Mapper, although I have
never used it. (See the LVM HOWTO for more


Collapse -


by Dumphrey In reply to That is good to know !

Thats some good info. I was very suprised that it worked at all, only thing I can think is that its was using a spapshot function to image the open files. Being linux, it may have used the system calls to initiate snapshot on the DD idea really, but I will be looking into how to make use of the snapshots.

Collapse -

How it worked (Re: Stephen)

by StephenMollett In reply to That is good to know !

Don't forget that dd works by simply
copying the device (disk, partition, image
file, tape, etc.) one block at a time, and
has no concept of the filesystems or files
that reside on the device. It's just binary
data as far as dd is concerned. (It's quite
happy to let you do 'dd if=/dev/zero
of=/dev/null', which will run until you
stop it, copying never-ending zeroes into
the never-full bit-bucket! /dev/zero is
handy for wiping a disk reasonably
securely - I defy anyone to retrieve any
data afterwards without cracking open the
drive and using special equipment.)

So what it did was to copy each sector as
it went, and whatever happened to be in
that sector at the moment at which dd read
it in was what got saved in the clone. If a
file was added to a directory _after_ the
filesystem structure describing that
directory had been copied, the file would
not show up in the clone. The inode tables
would also be inconsistent with the disk

If you're feeling silly, you can even start
dd'ing then, a few minutes later, run mkfs
("format" in Windows parlance) on the drive
and dd will probably continue cloning it as
if nothing had happened. You might even be
able to mount the old filesystem in the
clone and see some of the files.

This is why you should really remount live
filesystems read-only if you're going to
image them with dd - it will ensure that
the filesystem stays consistent while it's
being cloned.

Also - *BEWARE* - the same works in
reverse: if you accidentally type something
like 'dd if=disk.img of=/dev/hda' instead
of, say, '... of=/dev/sda', you'll
overwrite your primary master IDE hard
drive, even if it's in use at the time!
(There are ways you can make this less
likely to happen, such as by using udev
rules to assign permissions for USB disks
that allow your regular user account to
access them directly instead of having to
be root. That way, you'll just get
an "access denied"-type error if you try to
overwrite your main drive.)

Collapse -

Mounting in 'read-only'

by w2ktechman In reply to That is good to know !

when I plug in a drive, it is automatically mounted. would I have to dismount it and then re-mount it as read-only?
If so, how would I add the read only part? Looking at the 'mount' command, it does not list this option.

Collapse -

(Re)mounting as read-only

by StephenMollett In reply to That is good to know !

The easiest way to remount a drive
read-only is to do:

mount -o remount,ro <mountpoint>

where <mountpoint> is the place where the
drive is mounted. (You can give the device
name instead of the mountpoint if you
prefer.) I don't use an automounter for
this very reason - I don't always want a
disk mounted when I attach/insert it (a
CD-RW or DVD-RW that I'm about to erase,
for example) and, if I do, I may not want
the default mount options.

If you're just going to image the drive,
you could simply unmount it from its icon
on your desktop (I'm assuming that these
fancy modern distributions all create
icons 'on the fly' for removable drives; my
homebrew system certainly did until I
disabled that feature).

Collapse -

I will have to play with this.

by Dumphrey In reply to That is good to know !

I can see how DD in and of its self is a very powerful tool. There is no need for a commercial product like ghost when DD will do this for free. A good multi disk VM seems just the thing to play with this.

Once again Stephen, good info and good descriptions of what DD is doing. Thanks again.

Back to Hardware Forum
26 total posts (Page 3 of 3)   Prev   01 | 02 | 03

Related Discussions

Related Forums