LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   Transferring build to new hard drive (https://www.linuxquestions.org/questions/mandriva-30/transferring-build-to-new-hard-drive-200874/)

NickC 07-03-2004 11:00 PM

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! :)

born4linux 07-04-2004 12:14 AM

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.

motub 07-04-2004 06:59 AM

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"

:)

NickC 07-04-2004 11:28 AM

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

born4linux 07-05-2004 05:23 AM

Quote:

Originally posted by motub
the secondary slave drive is /dev/hdd, not /dev/hdb.

:)

yay! :P thanks for the quick correction. thanks.

born4linux 07-05-2004 05:33 AM

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.

NickC 07-05-2004 11:55 AM

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?

NickC 07-06-2004 12:42 AM

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?

motub 07-06-2004 05:53 AM

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.

NickC 07-06-2004 08:27 AM

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.

motub 07-06-2004 08:39 AM

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.

NickC 07-06-2004 11:18 AM

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.

estatik 07-06-2004 12:55 PM

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.

NickC 07-06-2004 02:01 PM

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" ?

estatik 07-06-2004 04:13 PM

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.

NickC 07-06-2004 05:43 PM

Ahhh - I see - thanks! :)

NickC 07-09-2004 08:59 PM

I think this (mostly) worked! The last time I tried the dd command, it ran for like 2 1/2 hours and was still not done. I interrupted it and when I fired back up (with 10 Gb master and 80 Gb as slave), it started with this configuration panel that showed identical /dev/hda and /dev/hdb partitions! :)

So I plugged the 80 Gb as master, and all went well until the KDE startup. It complained that "Interprocess communication problem with KDE. Could not read network connection list /home/<user>/.DCOPserver_localhost_0"

I tried relogging in with Gnome, and that seemed okay except my panel was a little messed up - icons weren't setup the way I last had them.

Is this an easy fix for the KDE issue?


All times are GMT -5. The time now is 02:18 PM.