LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 12-13-2007, 04:59 AM   #1
fareedreg
Member
 
Registered: Dec 2007
Posts: 51

Rep: Reputation: 15
Required help in HDD Cloning


Dear Friend

Can anyone please explain me how can I add a new HDD to my system and make a clone of my old hdd in new.

Thanks
 
Old 12-13-2007, 05:04 AM   #2
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
google g4u
 
Old 12-13-2007, 05:05 AM   #3
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
If they're identical, you can use dd (maybe run it off a live-cd so you don't have to mount the disks). There's a great thread here at LQ about dd, so you maybe want to read it, but the short usage is
Code:
dd if=/dev/hda of=/dev/hdb
Where you'll change the parameters when necessary - hda would be primary IDE disk, hdb secondary, but they might nowadays be called sda and sdb, so check it out. Also don't make that the wrong way, or it'll write the older drive empty

More options and help at:
Code:
man dd
Or you could use a cloning software like Nortong Ghost, but whatever you like..if the disks aren't equal in size (for example the new disk is bigger), you need to do something else, because dd doesn't (at least "by default") expand the filesystem over the whole disk, it merely makes an image and copies it to the other disk, exactly the same as the source is.
 
Old 12-13-2007, 05:08 AM   #4
fareedreg
Member
 
Registered: Dec 2007
Posts: 51

Original Poster
Rep: Reputation: 15
If there is any need to format or making partition in the new installed drive.
 
Old 12-13-2007, 05:11 AM   #5
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
If you use dd or other software that will clone the drive, i.e. make an image of it and then put the image onto the other disk, no. The image contains filesystems etc. too, so then you don't have to. If you want to, you can partition and format it and install a new OS yourself and then copy just files off the original disk, but cloning makes what it says - clones everything.

EDIT: you'll notice this also from (for example) what dd uses as source and destination: device file for the entire disk (hda and hdb). It doesn't ask for partitions if you're dd'ing the whole disk (partitions like hda1, hda2, hdb1, ...), nor ask you anything about the filesystems - simply which device (whole disk in this case) you want to read from, and which device to write to.

Last edited by b0uncer; 12-13-2007 at 05:13 AM.
 
Old 12-13-2007, 05:18 AM   #6
FredGSanford
Senior Member
 
Registered: Nov 2005
Location: USA
Distribution: Mageia 7 - Debian 10 - Artix Linux
Posts: 1,142
Blog Entries: 5

Rep: Reputation: 207Reputation: 207Reputation: 207
Take a look at Partimage to clone a hdd.
 
Old 12-13-2007, 05:21 AM   #7
fareedreg
Member
 
Registered: Dec 2007
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks to you all
 
Old 12-13-2007, 05:26 AM   #8
fareedreg
Member
 
Registered: Dec 2007
Posts: 51

Original Poster
Rep: Reputation: 15
Cloning had done but after removing old hdd and installed new linix was not booting its shows error

setuproot : error mounting/proc: not a directory
 
Old 12-13-2007, 05:35 AM   #9
FredGSanford
Senior Member
 
Registered: Nov 2005
Location: USA
Distribution: Mageia 7 - Debian 10 - Artix Linux
Posts: 1,142
Blog Entries: 5

Rep: Reputation: 207Reputation: 207Reputation: 207
You may need to make changes to your /etc/fstab file.
 
Old 12-13-2007, 06:40 AM   #10
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by fareedreg View Post
Cloning had done but after removing old hdd and installed new linix was not booting its shows error
If you clone a drive, and the drives have different geometry, you will have an incorrect partition table in the MBR. This can cause boot problems. I use partimage to save and restore partitions, and fdisk to partition drives. After you setup the partitions on a new drive, you will still need to install a boot loader. Look at the man page for grub-install. Typical usage is to mount the restored boot partition and run something like this:

# grub-install --root-directory=/mnt/system /dev/sda
 
Old 12-13-2007, 09:34 AM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
If the hard disk is properly cloned there would be no need to change anything. dd cannot make anything other than 100% miiror of the original.

Thus the original should be removed and the cloned disk takes up its place. Once working properly the old disk may be hooked back as a different drive if it is a Linux.

More details is here.
 
Old 12-13-2007, 09:46 AM   #12
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Rep: Reputation: 30
Quote:
Originally Posted by saikee View Post
If the hard disk is properly cloned there would be no need to change anything. dd cannot make anything other than 100% miiror of the original.

Thus the original should be removed and the cloned disk takes up its place. Once working properly the old disk may be hooked back as a different drive if it is a Linux.

More details is here.
Does the HD onto which you dd the clone have to be of the same size as the original ?

ie Cloning hda onto hdb, hda is 20Gb and hdb is 40Gb,

If the hds do not have to be of the same size could you just specify the cloned HD to be saved as a file and still keep the remaining 20GB on hdb for other file sharing purposes.

eg. would below be valid.
Code:
# dd if=/dev/hda of=/mnt/hdb1/tmp/hda.clone
Thanks,
Uncle
 
Old 12-13-2007, 11:41 AM   #13
masterclassic
Member
 
Registered: Jun 2007
Distribution: Knoppix, antiX
Posts: 252

Rep: Reputation: 73
About your latest exemple, I understand the following: to write a file in a partition (hdb1 in this case), this partition must *already* exist. So, this would be just something like an image of the original disk. Nevertheless, which filesystem in hdb1 would permit a 20GB long file?
 
Old 12-13-2007, 11:57 AM   #14
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Rep: Reputation: 30
Oh ! Thanks masterclass. I forgot that dd would copy the entire hd and not ONLY just the "system + files." Meaning that if my OS and all the associated files took up say 2Gb out of the 20Gb on the HD, dd would copy the 2Gb along with the "empty" remaining 18Gb. So

Code:
# dd if=/dev/hda of=/mnt/hdb1/tmp/hda.clone
would not be viable as no f/s allows for such big files.

Thanks again

uncle
 
Old 12-13-2007, 12:37 PM   #15
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by saikee View Post
dd cannot make anything other than 100% mirror of the original.
Exactly. However if the drives are not identical (Same manufacturer, same drive size, and same number of cylinders), an identical copy will not work, due to having different numbers of cylinders.
 
  


Reply



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
Windows XP cloning help required! darkscot Linux - General 16 05-22-2007 12:39 AM
HDD space required for LAMP server? WorldBuilder Linux - Networking 2 03-17-2007 06:45 AM
Where would I get required RPM's to install RHEL-4 on my SATA HDD mohd anas Linux - Hardware 1 11-07-2006 05:40 AM
How to format & mount 2nd hdd after FedCor1 has been installed on 1st hdd? clay394 Fedora 1 05-18-2004 01:50 PM
No cdrom after cloning to another HDD stelmed Slackware 12 05-17-2003 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:02 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
Open Source Consulting | Domain Registration