Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-13-2007, 06:36 AM   #1
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.
Old 12-13-2007, 10:38 AM   #2
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, 11:06 AM   #3
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, 07:28 PM   #4
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112

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, 07:47 PM   #5
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
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, 02:10 AM   #6
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, 03:09 AM   #7
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 978

Rep: Reputation: 118Reputation: 118
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, 12:05 PM   #8
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
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 12:17 PM.
Old 05-17-2011, 09:49 AM   #9
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.

#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/

#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 09:51 AM.


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 01:07 PM
how to do a dual boot (Windows on portable HDD) linux on computer HDD izquierdista Linux - General 5 01-28-2006 10:50 AM
Trying to add a third hard drive (hdd) and get Unable to open /dev/hdd MikeyCarter Linux - Hardware 4 12-26-2005 11:27 PM
How to format & mount 2nd hdd after FedCor1 has been installed on 1st hdd? clay394 Fedora 1 05-18-2004 02:50 PM
No cdrom after cloning to another HDD stelmed Slackware 12 05-17-2003 10:27 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:39 AM.

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