LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2011, 06:01 PM   #1
attila01
LQ Newbie
 
Registered: May 2011
Posts: 9

Rep: Reputation: 0
How to perform HDD cloning/mirroring with Linux?


Hi,

Currently I backing up the MBR, the C and the other partitions to an external USB HDD and from there I restore them if needed.
I use the SystemRescueCd and commands like
dd if=/dev/sd* of=/mnt/PC_name/backupmbr.1 count=1 bs=512 and ntfsclone --save-image --output /mnt/PC_name/PC_name_c.img /dev/sd*1 etc.
I want to clone the HDD the way, however, that I omit the external USB drive. I want to connect the new HDD to the PC and do the cloning directly from one disc to the other.

My questions are:
- Can you provide me with the exact command?
- Is that a difference if the disc is SATA or IDE?
- Can I copy the disc even if the old disc don't wan to boot?

The OS is Windows on the disc I want to clone.
 
Old 05-10-2011, 08:13 PM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian, OS X
Posts: 1,298

Rep: Reputation: 102Reputation: 102
I have heard from my colleague that Acronis works good for cloning (backing up) and restoring hard drives (including C.

However, I have never used it.
 
Old 05-10-2011, 08:16 PM   #3
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
As far as I know, Acronis is a paid s/w. If you want a freeware, try clonezilla. I have used Clonezilla in the past succesfully to clone Linux partition. You could give it a try.
 
Old 05-10-2011, 08:39 PM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian, OS X
Posts: 1,298

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by professorrmd View Post
As far as I know, Acronis is a paid s/w. If you want a freeware, try clonezilla. I have used Clonezilla in the past succesfully to clone Linux partition. You could give it a try.
OP wants to clone Windows partition, does Clonezilla works on windows too ?

If yes, please share references of HOW-TOs.
I would love to try it.

I did not succeeded last time when I tried it.
 
Old 05-10-2011, 08:45 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Not much difference between dd and acronis.

You would have to tell us how your booted live cd/usb shows the hardware. Then you could determine the exact command. To me it looks like you kind of went overboard on the command. dd can be pretty simple.

Most newer distros treat ide like scsi so they are now being called sda or sdb2 or such. Some common distros made for older stuff may still use the old hda, hdb3 deal. Sata and IDE would be some reference to sd.

dd is somewhat powerful. It may be able to clone all of the readable. You have two issues. One is bootable and the other is readable. Bootable may have nothing to do with readable so you may need to determine that. dd and others like gnome ddrescue and ddrescue. There are some switches to most commands that allow for non-readable blocks or sectors or such.

If a drive is mostly readable it would be possible to clone most of it to get some data off. As to the quality of data it would be unknown. Readable text is easy to test, movies and audio may not matter too much if a small bit is lost.

There are tons of ways to copy and clone. You'd have to read up on each to decide what is best.

Sometimes when you clone smaller to larger you might have to play with it a bunch.

Windows doesn't like being cloned ide to sata by the way. You'd have to fix the hal before or after if possible.
 
Old 05-10-2011, 09:58 PM   #6
attila01
LQ Newbie
 
Registered: May 2011
Posts: 9

Original Poster
Rep: Reputation: 0
When I connect the external USB HDD and start the PC with the SystemRescue CD then I can see following:
Device Boot -- Start -- End-- Blocks -- ID -- System
/dev/sda1-- 1 -- 9728 -- 78140128-- 7 -- HPFS/NTFS
/dev/sda2-- 9729 -- 19457 -- 78148192-- f -- W95 Ext’d (LBA)
/dev/sda5-- 9729 -- 19457 -- 78148161-- 7 -- HPFS/NTFS


/dev/sdb1-- 1 -- 121601 -- 976760001 -- 7 -- HPFS/NTFS

sdb is the external USB drive

When I put a second HDD into the PC (external USB drive is disconnected) then I can see following:

Device Boot -- Start -- End --Blocks -- ID -- System
/dev/sda1 -- 1 -- 9728 -- 78140128 -- 7 -- HPFS/NTFS
/dev/sda2-- 9729 -- 19457 --78148192 -- f -- W95 Ext’d (LBA)
/dev/sda5-- 9729 -- 19457 --78148161 -- 7 -- HPFS/NTFS

/dev/sdb1-- 1 -- 4865 -- 3907881 -- 7 -- HPFS/NTFS
/dev/sdb2-- 4866 --9729 -- 39070080 -- f -- W95 Ext’d (LBA)
/dev/sdb5-- 4866 -- 9729 -- 39070048 --7 -- HPFS/NTFS

sdb is now the second disc

Do I get the command now? :-)
 
Old 05-10-2011, 11:05 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
If any other tech has a better answer please feel free to offer assistance.

dd still kind of scares me. If you get in a hurry this command will burn you.

I am not trying to deny you an answer.

I will warn you that dd can and has made mice of men. It is a unforgiving command.

I will tell you a very simple answer but you need to look at a few links I'll post just to be sure we are on the same page.

If you don't care about the data on sdb then try this.

dd if=/dev/sda of=/dev/sdb


http://www.backuphowto.info/linux-ba...-disk-clone-dd

http://www.howtogeek.com/howto/19141...buntu-live-cd/

http://serverfault.com/questions/490...r-disk-cloning

Last edited by jefro; 05-10-2011 at 11:08 PM.
 
Old 05-11-2011, 01:20 AM   #8
mikeb380
LQ Newbie
 
Registered: Apr 2011
Location: SC
Distribution: ubuntu 10.10 trying 11.04 & kbuntu 10.10
Posts: 25

Rep: Reputation: 1
Quote:
Originally Posted by attila01 View Post
Hi,

Currently I backing up the MBR, the C and the other partitions to an external USB HDD and from there I restore them if needed.
I use the SystemRescueCd and commands like
dd if=/dev/sd* of=/mnt/PC_name/backupmbr.1 count=1 bs=512 and ntfsclone --save-image --output /mnt/PC_name/PC_name_c.img /dev/sd*1 etc.
I want to clone the HDD the way, however, that I omit the external USB drive. I want to connect the new HDD to the PC and do the cloning directly from one disc to the other.

My questions are:
- Can you provide me with the exact command?
- Is that a difference if the disc is SATA or IDE?
- Can I copy the disc even if the old disc don't wan to boot?

The OS is Windows on the disc I want to clone.
I just cloned my win XP drive to a new drive as the old one was dying. I used Clonzilla which did an excellent job. It is placed on a live CD and booted. (If you use it, get the Quick Reference Guide and read it carefully before you start. There are sevral options and processes as you can use Clonezilla for backup, to clone a drive to another drive or to clone partition to partition. Cloning the drive is a direct drive to drive procedure. The user guide is pretty specific as to how to go about this. This way you don't have to boot on any hard drive, just from the Clonzilla live CD. Doesn't matter if drive is PATA or SATA. Clonzilla could care less. If the boot partition is screwed up, you can reinstall it using the Win install disk and clonzilla. Before you begin the clone process use Clonezilla to back up the drive to another drive, a USB drive would be good. 'Taint as hard as it sounds here.
Michael
 
Old 05-11-2011, 11:34 PM   #9
attila01
LQ Newbie
 
Registered: May 2011
Posts: 9

Original Poster
Rep: Reputation: 0
I tried with dd-ing (direct disk to disk copy) but I interrupted it after more then 2 hours. I will try it again with a progress indicator later.
 
Old 05-12-2011, 12:17 AM   #10
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
@attila01
Clonezilla-live-cd can clone your drive disk for disk or partition for partition as far as drive names cloning from sda to sdb once it is done and the 2 drives are seperated the target drive when placed in machine will be sda an exact copy & bootable.
But if you are cloning to a usb drive you don't boot machine with usb connected, after selecting the source disk it will prompt you to attch usb drive & wait 5 seconds before pressing enter. It does not tell you about the 5 second rule in any of the tutorials, but if you look at text at bottom of screen you'll see it. Clonezilla-live-cd
http://geekyprojects.com/cloning/how...illa-tutorial/

If cloning to a larger drive reboot machine check out os, then reboot into something like gparted-live-cd and resize

Last edited by EDDY1; 05-12-2011 at 12:20 AM.
 
1 members found this post helpful.
Old 05-12-2011, 06:30 PM   #11
attila01
LQ Newbie
 
Registered: May 2011
Posts: 9

Original Poster
Rep: Reputation: 0
OK, I will try it with Clonezilla, but first with dd

I'm trying right now to make an image file from the HDD of the PC (sda) to an external USB HDD (sdb)
I mounted the external drive and entered the dd command. The error message I got is following:

dd: opening '/mnt/Image/backuptest.img': Read-only file system

How can it be read-only?
I always use this command: mount /dev/sdb1 /mnt
It worked with that in the past.
 
Old 05-12-2011, 07:00 PM   #12
attila01
LQ Newbie
 
Registered: May 2011
Posts: 9

Original Poster
Rep: Reputation: 0
I found how to make the progress indicator visible. (in the links of jefro)
It looks like this: (disk to image file)
dd if=/dev/hdb | (pv -s `fdisk -l /dev/hdb | grep -o '[0-9]*\{1\} MB' |awk '{print $1}'`m) | cat > hdb.img

My question:
How to amend the above to make a disk to disk cloning? (if input file=sda and output=sdb)
 
Old 05-13-2011, 08:45 AM   #13
attila01
LQ Newbie
 
Registered: May 2011
Posts: 9

Original Poster
Rep: Reputation: 0
the read-only problem is solved.

I still need to know how to change the command, disc to image file, to disc to disc.
 
Old 05-14-2011, 02:47 PM   #14
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
Quote:
Originally Posted by vikas027 View Post
OP wants to clone Windows partition, does Clonezilla works on windows too ?

If yes, please share references of HOW-TOs.
I would love to try it.

I did not succeeded last time when I tried it.
I wrote a clonezilla live CD, booted from the CD and simply answered the questions asked (typically clone disk/partition, source, destination, etc). I did not have any problems. The only thing, I must admit I have not tried yet, is that I have not had the need to recover my system from the clone.
 
Old 05-14-2011, 06:26 PM   #15
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Wonder if you replace the cat > /dev/sdb would work.

I'd be more inclined to replace the cat with of=/dev/sdb and try it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hdd cloning fareedreg Linux - Newbie 8 05-17-2011 09:49 AM
HDD mirroring between 2 PCs vaibhavs Linux - Software 4 10-18-2008 05:19 AM
mirroring hdd to usb hdd with partimage ghetto-betto Ubuntu 3 05-27-2008 05:23 PM
Required help in HDD Cloning fareedreg Linux - Newbie 25 12-16-2007 01:07 PM
Kernel Panic on mirroring HDD ALInux Debian 2 07-31-2006 08:38 AM


All times are GMT -5. The time now is 04:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration