LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 05:36 AM   #1
fareedreg
Member
 
Registered: Dec 2007
Posts: 51

Rep: Reputation: 15
hdd cloning


Please help me in cloning a new hard disk in old system in such a way so I can remove old hdd and installed new after cloning with same data and boot information.
thanks
 
Old 12-13-2007, 09:38 AM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
How about this?

It works between different hard disk types, external and internal disks, 2.5" and 3.5" disks.

You can have as many OSes in the hard disk too and the types of operating systems do not matter either.
 
Old 12-13-2007, 10:06 AM   #3
Kahless
Member
 
Registered: Jul 2003
Location: Pennsylvainia
Distribution: Slackware / Debian / *Ubuntu / Opensuse / Solaris uname: Brian Cooney
Posts: 503

Rep: Reputation: 30
Google: gnu disk cloning
 
Old 12-13-2007, 06:28 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Kahless,

When you Google to the end of the world you will find hard disk cloning in Linux is done by a simple command called dd.

This forum is famous in a way that there is thread written and maintained by a member called AwesomeMachine on "Learn the dd command" which is authoritative on the subject from the user point of view.

I offer my link as a typical application.

Yet you think Google is better.
 
Old 12-13-2007, 06:47 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
It doesn't hurt to point out other tools besides dd.
As a matter of fact, I rather enjoy using the Clonezilla livecd for disk backup and restore.
 
Old 12-14-2007, 01:10 AM   #6
fareedreg
Member
 
Registered: Dec 2007
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks friends but my old hdd is 30GB Maxtor and I would like to install new one of 80GB. Does it matter as in the previous forums someone write that if you use different size of hdd then the command must be different. If there any other command plese let me know thk.
 
Old 12-14-2007, 02:09 AM   #7
Pearlseattle
Member
 
Registered: Aug 2007
Location: Switzerland
Distribution: Gentoo
Posts: 701

Rep: Reputation: 80
With dd it will work 100% if your old hd is smaller (or at least exactly equal) than the new one.
The easy method I used was using "dd". Using a boot-cd, so that no filesystem is mounted (and no data is changed while the cloning process is running) and issuing "dd if=/dev/oldhd of=/dev/newhd" will clone partition table, boot record, data and everything else. You will end up having a 1:1 copy in your destination hd, the new one. Here the "problem" is that if the new hd is bigger than the old one, you will afterwards have to create a new partition to use the space which is left over and the old partitions will not have more space available, as with dd you're not changing the partition sizes - just copying them 1:1.
Another method would be to partition the new hd with the structure you want, perhaps very similar to the old hd but with bigger partitions, mount both new and old HDs, go to the root directory of the source hd and copy the files with "cp -Rxva" to the partition of the destination hd which will contain your root filesystem and do the same for all other partitions.
 
Old 12-14-2007, 11:05 AM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I would recommend users to clone a smaller hard disk to a bigger hard disk by using dd. It is bomb proof, watertight, fastest, simplest and independent of the software. The last one means you can clone a disk with a Linux operating at the same time because dd reads the sectors from one disk and writes them on another. Whether or not the partitions are mounted has no consequence. dd has nothing to do with the mounted partitions. It operates on the hardware level only. It can only read/write "1" and "0" until either the number of sectors in the source or the target disk has been exhausted. It is therefore very reliable. I could be wrong but I doubt is there is anything simpler than one Bash command
Code:
dd if=/dev/sda of=/dev/sdb bs=32256
that can clone any size of hard disk with any type and number of operating systems inside? The use of bs=32256 is optional to speed up the cloning by one track of 63 sectors by 512 bytes per sector. Without it the default bs size is 512 bytes (or just one sector so it is a lot slower).

To resize all operating system except the Vsita partition I recommend Gparted or Parted Magic Live CD.

To reize a Vista partition I recommend the user to use Vista's own resizing function inside the disk management program.

Last edited by saikee; 12-14-2007 at 11:17 AM.
 
Old 05-17-2011, 08:49 AM   #9
jhnnma
LQ Newbie
 
Registered: Jul 2010
Location: West Australia
Distribution: LinuxOS 09
Posts: 5

Rep: Reputation: 0
Another clone tool

Anyone thought of or use rsync, easily set up using a short script and then automate thru crontab.

Below is my script backing up my home folder of 84 Gbs to a external Samsung 2 Tb hard drive via a usb 2.0 cable. First copy is painful, has to back up every directory and folder but subsequent backups take aprox 7 minutes. Reason for this is because the second and following backups simply mirror any changes on the hard drive. I created 2 folders on the samsung called daily and weekly. Into these I make a daily backup every night at 9pm and then weekly I make another copy called weekly, this then gives 7 days to decide whether or not to roll back to a known good backup.

Suggest a Google search on rsync to check out the various options, my script only does my home directory with all users. Should be a simple matter to set this up to clone the whole hard drive but I have not done this. Posted below is the script I use. Hope this will be a bit of a guide.

Daily:
#!/bin/bash
#Script to back up my home directory minus movies and music dirs daily
rsync --archive --exclude=You\ Tube\ Videos/* --delete --log-file=/media/SAMSUNG/weekly/home-log /home /media/SAMSUNG/daily/

Weekly:
#!/bin/bash
#Script to back up my home directory minus movies and music dirs weekly
rsync --archive --exclude=You\ Tube\ Videos/* --delete --log-file=/media/SAMSUNG/weekly/home-log /home /media/SAMSUNG/weekly/
Note the only difference between these two scripts is the final destination.

The rsync program I use came with the base install of my distro (PC Linux OS 09)
Cheers .
edit poor punctuation.

Last edited by jhnnma; 05-17-2011 at 08:51 AM.
 
  


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
Required help in HDD Cloning fareedreg Linux - Newbie 25 12-16-2007 12:07 PM
how to do a dual boot (Windows on portable HDD) linux on computer HDD izquierdista Linux - General 5 01-28-2006 09:50 AM
Trying to add a third hard drive (hdd) and get Unable to open /dev/hdd MikeyCarter Linux - Hardware 4 12-26-2005 10:27 PM
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


All times are GMT -5. The time now is 06:35 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration