LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices

Reply
 
Search this Thread
Old 07-03-2004, 11:00 PM   #1
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Rep: Reputation: 15
Transferring build to new hard drive


I was sure this topic would have been covered before, but a search didn't turn up anything.

I have my Mandrake 9.2 on a 10 Gb drive. Today, I bought a Western Digital 80 Gb drive, and I'd like to transfer the entire setup to the new drive. At this point, I'm not sure how I'll split the 80 Gb drive. I believe WD comes with a utility that will let me do some basic partitioning and data transfer, but I don't know if it works for Linux.

Could I just mount the new drive as slave - copy everything over - and then reinstall the new drive but as master? Since Grub will already have the definitions as the master drive, once I put it to master I figured it would work.

Some step-by-step instructions would be helpful to this newbie!
 
Old 07-04-2004, 12:14 AM   #2
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
use "dd if=/dev/hda of=/dev/hdb"

/dev/hda is your existing system
/dev/hdb isyour target drive (set as secondary slave - hdb)

dd will 'replicate' hda - just like what norton ghost does.
 
Old 07-04-2004, 06:59 AM   #3
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
born4Linux-- this is great advice (I'm going to be doing this as well soon), but the secondary slave drive is /dev/hdd, not /dev/hdb.

hda: Primary master
hdb: Primary slave
hdc: Secondary master
hdd: Secondary slave.

Don't want poor Nick to copy to the wrong drive because he followed the instructions "blindly"

 
Old 07-04-2004, 11:28 AM   #4
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Original Poster
Rep: Reputation: 15
Perfect - thanks - I will try this!

Should this be done outside of a graphical environment?

And what will happen to the extra space? Right now, I haven't formatted or partitioned the 80 Gb drive. Do I first need to create partitions & format the same as my 10 Gb drive? The 10 Gb drive is something like this:

~4.5 Gb - Journalized ext3 /
~500 Mb - Swap
~ 4 Gb - Journalized ext3 /home
 
Old 07-05-2004, 05:23 AM   #5
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
Quote:
Originally posted by motub
the secondary slave drive is /dev/hdd, not /dev/hdb.

yay! :P thanks for the quick correction. thanks.
 
Old 07-05-2004, 05:33 AM   #6
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
Quote:
Originally posted by NickC
Perfect - thanks - I will try this!

Should this be done outside of a graphical environment?

And what will happen to the extra space? Right now, I haven't formatted or partitioned the 80 Gb drive. Do I first need to create partitions & format the same as my 10 Gb drive? The 10 Gb drive is something like this:

~4.5 Gb - Journalized ext3 /
~500 Mb - Swap
~ 4 Gb - Journalized ext3 /home
dd will 'replicate' your partition layout. the remaining 70Gig should be seen as free space when you run fdisk on it.

one more thing - do this using a rescue disk or a bootable linux live CD. you need to have the source/target unmounted for the replication.

i was checking out freshmeat for a ghost like program. found this:

http://g4l.networks-ltd.de/

it has an interface so it would present the cloning in an easier way.

Last edited by born4linux; 07-05-2004 at 05:38 AM.
 
Old 07-05-2004, 11:55 AM   #7
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Original Poster
Rep: Reputation: 15
Excellent - thanks for clearing up the hard drive space question.

I have Knoppix v3.2 bootable Linux CD, so I'll try that first. If I can't get it to work, then I'll try that program you suggested.

But I seem to recall from the brief time I used the Knoppix CD - don't these bootable Linux CDs prevent the user from writing to the hard drive? Or is there a simple command around that?

Last edited by NickC; 07-05-2004 at 01:55 PM.
 
Old 07-06-2004, 12:42 AM   #8
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Original Poster
Rep: Reputation: 15
Okay, I tried this just now with Knoppix. Thing is, it seemed to hang there for a very long time after executing the "dd" command (from root console). I waited like 20 minutes or so - the whole time the hard drive lights were steady - not flashing. I thought maybe something got hosed, so I killed it.

I inspected a little, and it seemed some of the files got copied. So is this just a very lengthy process that my need a couple of hours? Or did something else go wrong?
 
Old 07-06-2004, 05:53 AM   #9
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
You're copying like 10 GB of data. That does not go quickly, and the fact that your hard drive lights were steady just likely meant that the copy was moving large files (or small files so rapidly that the light didn't have time to go off before coming back on again). Also, this is not just a simple copy, but a mirroring of the partition as a whole, so the hard drive is going to be constantly read to accurately copy the file architecture while copying the files themselves.

Lastly, dd is a low level process that may not go very fast. But it was clearly working if some of the files got copied. Norton Ghost (which 'replicates a hard drive partition' under Windows) isn't very fast either.

So my suspicion is that the answer is 1) this is just a very lengthy process that may need a couple of hours, and that nothing was in fact wrong (until you stopped the process while it was in progress, of course).

But maybe born4Linux will come by and confirm that for us.
 
Old 07-06-2004, 08:27 AM   #10
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Original Poster
Rep: Reputation: 15
Thanks! So assuming the copy was progressing correctly, now that I messed it up by interrupting it, what's the best way to proceed? Should I first go into the 80 Gb drive and wipe it out? Or should I just repeat the "dd if=/dev/hda of=/dev/hdb" command? i.e., will the dd command automatically overwrite where necessary?

I also noticed that my Knoppix CD contains a program called PartImage which is supposed to work well in this scenario (from what I understand). Only thing is, when I tried to execute it, it warned me that I wasn't root. I'll probably have to find the executable file and launch it from a root console.

Last edited by NickC; 07-06-2004 at 08:30 AM.
 
Old 07-06-2004, 08:39 AM   #11
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
It should be in /bin, /sbin/, /usr/bin or /usr/sbin. The problem is most likely not that you have to "find" it (root knows where it is, and so does the user, if you got a warning rather than "command not found"), but that only root has access to certain functions that are needed to run the program. To explain further with an example: you can run k3b-- the CD burning program-- as a user as well, but unless you either are root, or have properly configured the programs for which k3b is a graphical front-end (those programs being cdrecord, cdrdao and others), you won't actually be able to burn CDs using K3b as a user (which is why K3b offers to reconfigure the backend for you the first time you run it as a user). Similarly, PartImage most likely uses such programs as cfdisk or fdisk as its backend, and those programs only function in limited scope as a user.

You can most likely just open a terminal, su (or sudo, this being Knoppix) to root and run the program just like you did before (using partimage), but for the future, the easiest way to find a command's path is to type which <program_name> into a terminal; that will return the path of the <program_name> command.

As to your first question, I don't know much about dd, but I would imagine that you should just run the command again. It may prompt you to ask what to do about overwriting files, or there may be an additional switch to tell it to just overwrite automatically. I would suggest looking at man dd or typing dd --help into a terminal to see which it is.
 
Old 07-06-2004, 11:18 AM   #12
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Original Poster
Rep: Reputation: 15
I did do a man dd yesterday, but all it contained were references to block size and conversions using dd. I don't recall seeing anything related to overwriting. I just didn't want a situation where the files that were copied just sit there taking up space. I'd rather they get overwritten. Oh well - guess I'll try it again and see what happens!

I'll post back results.
 
Old 07-06-2004, 12:55 PM   #13
estatik
Member
 
Registered: Oct 2003
Location: CA / NY
Distribution: Mandrake 9.1, 9.2, 10.1, Cooker
Posts: 145

Rep: Reputation: 15
I think I might have a quicker solution for you to transfer/copy from one hdd to another...take a look at this thread and adjust to your system's settings. A bit more work than the previously stated method, but works for me. It takes me about 1 hour to duplicate a 40 hdd, which is basically in case of complete system fubar/"back-up" . I don't use grub, but I'm sure you can figure it out.
 
Old 07-06-2004, 02:01 PM   #14
NickC
Member
 
Registered: Nov 2003
Location: Portland, OR, USA
Posts: 111

Original Poster
Rep: Reputation: 15
Wow - that is a detailed response in your other post! I'm curious though - why do you think that's a better solution than the simple command "dd" ?
 
Old 07-06-2004, 04:13 PM   #15
estatik
Member
 
Registered: Oct 2003
Location: CA / NY
Distribution: Mandrake 9.1, 9.2, 10.1, Cooker
Posts: 145

Rep: Reputation: 15
I wouldn't say it's a better way, it's just another option I threw at you.

The reason I use the "cp" method is: 1) I can control the size of the partition(s) that I'm copying to and also expand/add them. For example, say that I wanted to copy a drive that has been partitioned as:

/ hda1 (4.75GB)
swap hda5 (250MB)
/home hda6 (4.75GB, only 1 GB used)

Then, say I wanted to add a /var partition to the new hard drive and shrink the /home partition ( I know I said that you can't decrease the partition size in the other thread, but what I meant was that you can't decrease it below the actual size used on the "doner". But expanding the partition is only limited on disk space.) I can then set up the partitions on the new hard drive as:

/ hda1 (4GB)
swap hda5 (250MB)
/home hda6 (3GB)
/var hda7 (2.75GB)

Then after I'm finished cp'n over all the files, I can move the /var partition from / hda1 to the new partition /var hda7 and make the fstab, symlink, etc. adjustments accordingly.

The "dd" method will copy over everything, including the unused space (block for block?), whereas the "cp" method only copies the actual files. So, if one wants to change/shift/contract/expand the partitioning scheme and use the new hard drive, it's very flexable to do so.

Another reason why use it, is that I can use a smaller hard drive to back up just my os partitions to, instead of the whole drive.

Last edited by estatik; 07-06-2004 at 04:15 PM.
 
  


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
Transferring Hard Drive to Newer Computer kaplan71 Suse/Novell 2 11-04-2005 04:11 PM
Transferring Hard Drive to Newer Computer kaplan71 Fedora 1 11-04-2005 01:32 PM
transferring linux to an external hard drive martha123 Linux - Newbie 1 09-21-2005 09:48 AM
Transferring OS to new Hard Drive thenebula Linux - Newbie 6 10-29-2004 09:06 PM
Transferring data from a WinXP Hard drive satimis Linux - Hardware 3 08-19-2004 06:34 AM


All times are GMT -5. The time now is 07:49 PM.

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