Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-29-2005, 05:47 PM   #1
Registered: Feb 2004
Location: Reno, Nevada
Distribution: Mandrake 9.2
Posts: 221

Rep: Reputation: 30
Hard drive dying. Need to move Linux partition over.

Recently, my hard drive has been dying. (making dying noises and such, Windows freezes, had to reinstall windows, everything). It is a 80GB Western Digital hard disc, and I'm currently doing an advance RMA (Where they ship me a replacement hard drive before I even ship mine out until 30 days. This gives me the advantage to copy the OS over.) Now, is there a way I could do this? Move my whole mandrake 10.1 official OS over to the new HD with the right software? Is there a program in windows that could do this, like patition magic? Thanks...
Old 01-29-2005, 06:09 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
if you're getting a straight swap with identical hardware you shouldn't have a problem cloing each partition via "dd" on the new drive, create partitions that match the old ones, and then use dd under a linux boot cd or something:
dd if=/dev/hda1 of=/dev/hdb1
that should clone the partition for you no problem. To be honest i've not done it myself ever, but that's how it get's done.

Last edited by acid_kewpie; 01-29-2005 at 06:11 PM.
Old 01-29-2005, 06:11 PM   #3
Registered: Apr 2004
Location: Oxford, UK
Distribution: Ubuntu, Debian, various
Posts: 230
Blog Entries: 5

Rep: Reputation: 33
/edit - doh! Beaten to it!

I would do this:

1) Get both drives into the machine at once.
2) Install Windows (if you must!)
3) Use the Mandrake installer to create partitions exactly the same size as the Mandrake partitions on the old disk, or slightly larger.
4) Boot into a recovery CD
5) Copy the raw file systems across using DD
6) fsck
7) resize2fs

Yes I know this is not a complete answer, but hopefully you see what I'm getting at. The important point is that in Linux you can copy an entire drive partition as if it was just a normal file, which sorts out the copying, and that the Mandrake installer is all you need to sort out the partitioning.

Or as you say you could use Partition Magic, but that is not free software.


Last edited by avarus; 01-29-2005 at 06:12 PM.
Old 01-29-2005, 06:14 PM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
If the drives are identical, you could use the dd command. Suppose that the original drive is /dev/hda and the target is /dev/hdb. Then try:
dd if=/dev/hda of=/dev/hdb & pid=$! &
kill -USR1 $pid; sleep 99
The parts 'pid=$!' and the second line are not necessary. The second line shows how to monitor the number of records read and written so far. You may find this convenient for a very large copy.

Another option is to use the tar command. This example is from an 'info tar' page.
Notable `tar' Usages

_(This message will disappear, once this node revised.)_

You can easily use archive files to transport a group of files from one
system to another: put all relevant files into an archive on one
computer system, transfer the archive to another system, and extract
the contents there. The basic transfer medium might be magnetic tape,
Internet FTP, or even electronic mail (though you must encode the
archive with `uuencode' in order to transport it properly by mail).
Both machines do not have to use the same operating system, as long as
they both support the `tar' program.

For example, here is how you might copy a directory's contents from
one disk to another, while preserving the dates, modes, owners and
link-structure of all the files therein. In this case, the transfer
medium is a "pipe", which is one a Unix redirection mechanism:

$ cd sourcedir; tar -cf - . | (cd targetdir; tar -xf -)

The command also works using short option forms:

$ cd sourcedir; tar --create --file=- . | (cd targetdir; tar --extract --file=-)

This is one of the easiest methods to transfer a `tar' archive.
You would need to partition the replacement drive ahead of time and mount it somewhere first. Then run the line for each partition.

Last edited by jschiwal; 01-29-2005 at 06:16 PM.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this hard drive dying? newmoon Linux - Hardware 5 11-14-2005 03:46 PM
Hard drive dying, good backup method cadj Linux - Software 3 12-14-2004 08:28 PM
URGENT: Hard drive is dying, need migration AngryLlama Linux - General 12 11-27-2004 11:31 AM
Move an existing partition to a new hard drive? vdemuth Linux - Hardware 9 06-04-2004 03:29 AM
Can I move my linux installation to another Hard Drive? enderjm Linux - Newbie 7 03-11-2004 03:00 AM > Forums > Linux Forums > Linux - General

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