Copy a hard drive to another hard drive

Questions about applications and software
Forum rules
Before you post please read how to get help

Copy a hard drive to another hard drive

Postby jhouse59 on Tue Oct 14, 2008 10:02 am

Does anyone know of a software or anyway to copy a hard drive to another hard drive? I'm wanting to copy the partitions and system to the new drive.
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Linux Mint is funded by ads and donations.
 

Re: Copy a hard drive to another hard drive

Postby timh on Tue Oct 14, 2008 10:43 am

I would take the Live CD “SystemRescue” from here http://tinyurl.com/ez659
there is a program called “Partimage” to copy partitions.
But you have to look for “Grub Menu List” and for /etc/fstab
if something is diffrent [SATA,...].

If you need a “How To” feel free to ask :D
LMDE2 UP7
Image
Image Image
User avatar
timh
Level 3
Level 3
 
Posts: 133
Joined: Thu Oct 25, 2007 2:36 pm
Location: Spain

Re: Copy a hard drive to another hard drive

Postby Death Dream on Tue Oct 14, 2008 11:03 am

I only know how to do this in a Windows environment. So if you are wanting to do it in Windows I can help.

~Death Dream~
User avatar
Death Dream
Level 3
Level 3
 
Posts: 112
Joined: Fri Sep 26, 2008 9:23 am

Re: Copy a hard drive to another hard drive

Postby Zwopper on Tue Oct 14, 2008 1:02 pm

The example below will copy the partition sda1 to sdb4
Code: Select all
dd if=/dev/sda1 of=/dev/sdb4 bs=4096

Some explaining:
dd has more recently meant to stand for data duplicator, but actually, it stands for `Copy and Convert' and was renamed to `dd` only because `cc' was reserved for the C compiler!
if stands for Input File
of stands for Output File
bs stands for byte size -> the size of the data is chopped up to before it gets copied

For more tips open a terminal and type:
Code: Select all
dd --help
Image
My artwork at deviantART | My Tweet
CREA DIEM!
Lenovo E320 | 8GB | 512GB Samsung 840 PRO - SSD | Ubuntu 14.04
User avatar
Zwopper
Level 10
Level 10
 
Posts: 3101
Joined: Fri Nov 30, 2007 12:20 pm
Location: Deep in the Swedish woods

Re: Copy a hard drive to another hard drive

Postby jhouse59 on Wed Oct 15, 2008 8:40 am

timh wrote:I would take the Live CD “SystemRescue” from here http://tinyurl.com/ez659
there is a program called “Partimage” to copy partitions.
But you have to look for “Grub Menu List” and for /etc/fstab
if something is diffrent [SATA,...].

If you need a “How To” feel free to ask :D

Thanks for the information everyone .I've got the SystemRescueCD 1.1.0. Could you give me "How To" Timh? Will this program clone disk to disk. Or, do I need to save it to an image file first? :)
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Re: Copy a hard drive to another hard drive

Postby jhouse59 on Sat Oct 18, 2008 5:23 pm

timh wrote:I would take the Live CD “SystemRescue” from here http://tinyurl.com/ez659
there is a program called “Partimage” to copy partitions.
But you have to look for “Grub Menu List” and for /etc/fstab
if something is diffrent [SATA,...].

If you need a “How To” feel free to ask :D

I've tried to copy my hard drive to another one with Parimage. But, can't figure out how to do it. All the options are for making the image file first.


Zwopper wrote:The example below will copy the partition sda1 to sdb4
Code: Select all
dd if=/dev/sda1 of=/dev/sdb4 bs=4096

Some explaining:
dd has more recently meant to stand for data duplicator, but actually, it stands for `Copy and Convert' and was renamed to `dd` only because `cc' was reserved for the C compiler!
if stands for Input File
of stands for Output File
bs stands for byte size -> the size of the data is chopped up to before it gets copied

For more tips open a terminal and type:
Code: Select all
dd --help

I've tried to use this code to clone the drives. It seems like works. But, when I open it up in GParted. It says that its an unrecognized file system. I've tried it in Mint and from the SystemRescueCD cd. Neither one works.

I've tried Clonezilla 1.2.0-25. It works but, it erases my source partitions root and copys it to the target. It copies the swap and home partitions. Then I have to have both drives in to be able to boot into Mint.
Can someone help me????? :?
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Re: Copy a hard drive to another hard drive

Postby Fred on Sat Oct 18, 2008 7:00 pm

jhouse59,

If you want to clone one drive to another, carrying the partitions along with the data, then you probably should use some variation of the dd command. The requirement in that case is that neither of the drives can be in use or mounted to the system you are running the dd command from.

If your intent is to copy the information that is contained in a partition file system and duplicate it in another partition file system then you probably should be using the rsync command. The requirements in that case are that both the source partition and target partition have a supported file system, that neither partition be in use, and both partitions be mounted in the system the rsync command is being run from.

Using the example in an earlier post, you would use a live cd that supports rsync. The Mint live cd will do fine. I am assuming sda1 is the partition you want to duplicate. Make sure you have a supported file system on sdb4. Mount sda1 and sdb4. In a terminal type:

sudo rsync -arE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sda1/ /mnt/sdb4

I don't remember if the mount points default to /mnt or /media. If I guessed wrong, change the /mnt entries above to /media. You can look in /media after the partitions are mounted and see if they are there.

This will make an exact, uncompressed copy of the data on sda1 and put it on sdb4. All file permissions and attributes will remain the same.

If you wanted to restore the partition back like it was when you did the backup, you would use the below command which reverses the source and target partitions.

sudo rsync -arE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdb4/ /mnt/sda1

I hope this was helpful.

Fred
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Copy a hard drive to another hard drive

Postby jhouse59 on Sat Oct 18, 2008 9:02 pm

Thanks Fred...

I used the SystemRescueCD 1.1.0 and ran the:
Code: Select all
dd if=/dev/sda1 of=/dev/sdb4 bs=4096

in a terminal (I changed the drives to the one on my computer).
I did try it first in the Mint system. But, both times it didn't work. Right now I'm making an image with CloneZilla.

My source disk is "sdb" its divided up in a sdb1 = swap, sdb2 = root, and sdb3 = home. My target is "sdc1". On my source I'm using the "ext3" file system. So I need to format my target into "ext3"? If I understand you right.
In your code:
Code: Select all
sudo rsync -arE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sda1/ /mnt/sdb4

The "--delete --include" part want erase anything on the drive will it? Also, where the "*" are do I enter them in the code?

So would I type:
Code: Select all
sudo rsync -arE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdb/ /mnt/sdc1

:?

Thanks, Jerry
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Re: Copy a hard drive to another hard drive

Postby Fred on Sun Oct 19, 2008 12:10 pm

jhouse59

On my source I'm using the "ext3" file system. So I need to format my target into "ext3"?

The target partition can be formatted to any file system that the host system supports. The ext3 file system is fine.

The "--delete --include" part want erase anything on the drive will it? Also, where the "*" are do I enter them in the code?

The command, as I have it written, will delete everything on the target partition that doesn't match what is on the source partition.

With the new information you gave me, I'll show you how to save the partitions to files below.

As I understand it, you have three partitions you want to backup. The swap partition doesn't need to be backed up. There is no usable information left on it after a reboot anyway. So that leaves your / partition, sdb2, and your /home partition,sdb3, to be backed up.

Create a folder on sdc1 called MasterBackup. In that folder create a folder called root and another folder called home. Then run the below commands in a terminal, one at a time, from another system, as we talked about in my previous post.

sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdb2/ /mnt/sdc1/MasterBackup/root/root

sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdb3/ /mnt/sdc1/MasterBackup/home/home

Make sure sdc1 is large enough to hold all the data you will be storing there. After you run the above commands you should find all your data intact in the root and home folders under MasterBackup on sdc1. The data on sdb2 and 3 should not have been touched.

To restore you just reverse the source and target folders in the commands above.

sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdc1/MasterBackup/root/root/ /mnt/sdb2

sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdc1/MasterBackup/home/home/ /mnt/sdb3

The commands should be executed just as I have them above, including the "*", spaces, etc. You may have to change the /mnt to /media as we talked about before however.

Fred
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Copy a hard drive to another hard drive

Postby jhouse59 on Fri Oct 24, 2008 5:55 pm

Thanks Fred,

Fred wrote:jhouse59


sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdb2/ /mnt/sdc1/MasterBackup/root/root

sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdb3/ /mnt/sdc1/MasterBackup/home/home

Fred



I done what you said. It will not copy. This is the errors I get:
mint@mint ~ $ sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /mnt/sdd2/ /mnt/sdb1/MasterBackup/root/root
building file list ...
rsync: link_stat "/mnt/sdd2/." failed: No such file or directory (2)
0 files to consider
rsync: push_dir#3 "/mnt/sdb1/MasterBackup/root" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(565) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(454) [sender=2.6.9]


mint@mint ~ $ sudo rsync -arvE --progress --timeout=240 --delete --include "*" --include "*/**" /media/sdd2/ /media/sdb1/MasterBackup/root/root
building file list ...
rsync: link_stat "/media/sdd2/." failed: No such file or directory (2)
0 files to consider
rsync: push_dir#3 "/media/sdb1/MasterBackup/root" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(565) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(454) [sender=2.6.9]


The GParted in the Mint cd says that "sdb1 and sdd" is empty. In GParted I'm also getting a warning that says:
Unable to find mountpoint. Unable to read the contents of this filesystem! Because of this some operations may be unavailable.


But, when I open up the "Computer" icon in the menu. It shows the folders I'm trying to copy to. It also shows contents on both drives. That suppose to be there.
Any ideas?
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Re: Copy a hard drive to another hard drive

Postby Fred on Fri Oct 24, 2008 9:05 pm

jhouse59,

Ok... now you have me confused. Where are you getting these other partitions? I thought you said your / was on sdb2, your /home was on sdb3, and you wanted to backup to sdc1. If this isn't right, please tell me the correct partitions.

These 3 partitions must be mounted in either /mnt or /media of the system you are running rsync from. If you are calling these three partitions something else, please tell me their names and where they are mounted.

Rsync must be run from a system that is not located on the three partitions in question; either from a live cd, a usb drive/stick, or another HD partition.

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Copy a hard drive to another hard drive

Postby jhouse59 on Fri Oct 24, 2008 10:07 pm

Sorry to confuse you. I used GParted off of the Mint cd to get the new drive letters.
Fred wrote:jhouse59,

Ok... now you have me confused. Where are you getting these other partitions? I thought you said your / was on sdb2, your /home was on sdb3, and you wanted to backup to sdc1. If this isn't right, please tell me the correct partitions.

When I last posted that was the partitions I wanted to back up. It also still is. When I booted with the Mint 5.0 cd. That is the name or letters GParted gave them. I've added another hard drive I'd bought. The one I've got MInt installed on now. I'm going to copy to this new drive.

These 3 partitions must be mounted in either /mnt or /media of the system you are running rsync from. If you are calling these three partitions something else, please tell me their names and where they are mounted.

So now its listed as / is /dev/sdd2 and /home is /dev/sdd3. The one I'm trying to save to is /dev/sdb1. I've also tried using both /mnt and /media. I'm running this from the Terminal. Thats where I'm suppose to run it. Isn't it???

Rsync must be run from a system that is not located on the three partitions in question; either from a live cd, a usb drive/stick, or another HD partition.

I'm using the Mint 5.0 live cd to try and back these drives up.
Thanks, Jerry
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Re: Copy a hard drive to another hard drive

Postby jhouse59 on Sun Oct 26, 2008 10:19 pm

I used the GParted (0.3.4-6) live cd to copy my Mint install to the new drive. I had to unhook the other drives (except the one that had Windows on it). Its working so far.
When I hooked another hard drive up. Then rebooted I got an error message. It wouldn't start Mint. I think I'm just going to reinstall Mint on the new hard drive.
User avatar
jhouse59
Level 3
Level 3
 
Posts: 186
Joined: Wed Aug 15, 2007 7:27 pm
Location: Eastern Tennessee,USA

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: dany18, lisapisa2 and 22 guests