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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
12-13-2007, 04:59 AM
|
#1
|
Member
Registered: Dec 2007
Posts: 51
Rep:
|
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
|
|
|
12-13-2007, 05:04 AM
|
#2
|
Member
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995
Rep:
|
google g4u
|
|
|
12-13-2007, 05:05 AM
|
#3
|
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131
Rep:
|
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:
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.
|
|
|
12-13-2007, 05:08 AM
|
#4
|
Member
Registered: Dec 2007
Posts: 51
Original Poster
Rep:
|
If there is any need to format or making partition in the new installed drive.
|
|
|
12-13-2007, 05:11 AM
|
#5
|
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131
Rep:
|
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.
|
|
|
12-13-2007, 05:18 AM
|
#6
|
Senior Member
Registered: Nov 2005
Location: USA
Distribution: Mageia 7 - Debian 10 - Artix Linux
Posts: 1,142
|
Take a look at Partimage to clone a hdd.
|
|
|
12-13-2007, 05:21 AM
|
#7
|
Member
Registered: Dec 2007
Posts: 51
Original Poster
Rep:
|
Thanks to you all
|
|
|
12-13-2007, 05:26 AM
|
#8
|
Member
Registered: Dec 2007
Posts: 51
Original Poster
Rep:
|
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
|
|
|
12-13-2007, 05:35 AM
|
#9
|
Senior Member
Registered: Nov 2005
Location: USA
Distribution: Mageia 7 - Debian 10 - Artix Linux
Posts: 1,142
|
You may need to make changes to your /etc/fstab file.
|
|
|
12-13-2007, 06:40 AM
|
#10
|
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
Rep:
|
Quote:
Originally Posted by fareedreg
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
|
|
|
12-13-2007, 09:34 AM
|
#11
|
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Rep:
|
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.
|
|
|
12-13-2007, 09:46 AM
|
#12
|
Member
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299
Rep:
|
Quote:
Originally Posted by saikee
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
|
|
|
12-13-2007, 11:41 AM
|
#13
|
Member
Registered: Jun 2007
Distribution: Knoppix, antiX
Posts: 252
Rep:
|
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?
|
|
|
12-13-2007, 11:57 AM
|
#14
|
Member
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299
Rep:
|
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
|
|
|
12-13-2007, 12:37 PM
|
#15
|
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
Rep:
|
Quote:
Originally Posted by saikee
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.
|
|
|
All times are GMT -5. The time now is 03:06 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|