LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 05-23-2004, 11:58 PM   #1
tsw
Member
 
Registered: May 2004
Location: Colorado
Distribution: Mandrake 10 power-pack
Posts: 74

Rep: Reputation: 15
STUCK--Trying to copy old Hard Drive to new Hard Drive. Please Help


Friday I bought a new 60g hard drive. I was planning to copy my current set up from the older 15g drive to the new. With the rest of the space I planned on testing other flavors of the Linux. Currently I use Mandrake10 . I got all settled in and prepared to copy and transfer away. Wow! I never thought it would be such a process.

I installed the drive as a slave and booted into Mandy. I created four partitions to use for : / , /usr, /home, and swap. Formatted them with reiserfs and figured I was ready to start. I thought of transferring the data to the proper partitions using command dd if=/dev/hda* of=/dev/hdb* bs=128. I did this for each of the partitions. For partition hda1 / I received no errors and got back (sorry, I forget the byte total) something like xxxxxx+0 in
xxxxxx+0 out
For /dev/hda5 (/usr) I got back-- input-output error reading hda5. But the byte count came back fine.
xxxxxxx-0 in
xxxxxxx-0 in
We can repeat the results for hda7.

I was not really sure how to read this so I tried to boot up into the new HD. I reset it as master and received the 999999999999 panic. I shut down and rebooted with the install 1/rescue cd and reinstalled Lilo on the MBR. It was a success. I rebooted and my special graphic boot screen was present. Great! I thought. I thought to soon. I tried to boot into linux. I did not get very far.




resuming from /dev/hda7
Resuming from device hda7
KERNEL PANIC: Resume Machine: UNABLE TO FIND suspended-data signature ( -- misspelled?

I am not really sure what this means. So, I went in and tried to run the rescue/repair/update with cd1. As soon as the program started looking for partitions I got a swapon (dev/hda5) failed. figured that I am having some of these problems because /ect/fstab on the new partition is off. Can something like that be changed from that puny little command (rescue@root /) line??? I do not think so.

Okay, this was frustrating, but I am not a quitter. Next, I tried Parted. I read that it does not support reiserfs relocation without libreiserfs, so I installed that too. I installed parted from source and as far as I can tell--install was a success. I fired up the program and got busy.

parted cp /dev/hda
source partition? 1
destination partition? /dev/hdb1
error, can not find destination blah, blah

So it appears that I either do not know how to direct parted to copy from one drive to another--or, the program is not capable. I also had some other problems with parted reading partitions that were mounted. I had a real hard time with this one.

I have read many HowTo manual concerning anything close to this topic. There does not seem to be a lot out there specifically on partition transfer from disk to disk. Either this is a very easy process and I am one of the few people having a problem--or, this is not something that is done very often. The files on the dd command are few. Lost I am.

I am truly at my wits end. Please, if anyone has copied or cloned or rewritten their setup from one drive to another--keeping all executable programs) I could really use the help. I should say that I do not have windows on this computer, don't want, don't want to need it. I gave it up. So, as wonderful as Ghost is or Partition Magic, they are not really a solution. Any other suggestions I will gladly receive. This has been done before I am sure of it. Thanks in advance for any responses.

tsw

Last edited by tsw; 05-25-2004 at 04:41 AM.
 
Old 05-24-2004, 12:50 AM   #2
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,509

Rep: Reputation: 46
Do you know partimage? It's a nice partition backup tool, that you can download and use for free in the system rescue cd. I didn't transfer my partitions with it, but I did backed them up on cdrw. Very nice and easy.
Take a look:
http://www.sysresccd.org/
 
Old 05-25-2004, 04:39 AM   #3
tsw
Member
 
Registered: May 2004
Location: Colorado
Distribution: Mandrake 10 power-pack
Posts: 74

Original Poster
Rep: Reputation: 15
Thanks for the info. Obviously, I knew about parted and qtparted but partimage was very new to me. New and intriguing. That rescue cd is a great idea. Nice that those folks made an iso for it. I down loaded the package and gave it a try. I was a bit disappointed with the performance or partimage. It really is to bad because it sounded like a sure bet to work.

There was a problem with partimage's configurable nature. There was none. I was unable to choose the correct option. In fact the only option that I had was choosing which partition to work from. For whatever reason the program only allowed for "save partition to an image file." Where as I needed to restore partition from an image file. Oh, the choice was there but I had no way to enable it. Really was a shame.

Thank you again. This is a very cool resource that I was unaware of. In another circumstance I think it will come in very handy. Onward I go in search of the elusive copy the partition answer.
I am very surprised that this has not been done more often.

tsw
 
Old 05-25-2004, 08:16 AM   #4
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,509

Rep: Reputation: 46
How strange...
I was wondering why partimage wouldn't restore a partition, and the only thing I could come up with is that it only allows restoring a partition if you have free space left (unpartitioned) in the drives. Was that the case?
Did you take a look at the documentation?
 
Old 05-25-2004, 09:36 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,038

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
I sucessfully copied everything from an old, full disk to a bigger new one a couple of months ago. I am not sure dd is the right tool to use when partitions are of different sizes.

Here's what I did:
Install new hdd, I installed it as "slave" (hdb)
Create and format the partitions on it.
Go to single user mode.

mount the new home partition as /mnt/newhome
#cd /home (the old home!)
#tar cf - . | (cd /mnt/newhome && tar xBfp -)

Don't ask me how that tar command works, Tinkster told me it would, and it did copy all my users to their new home. File permissions / ownerships are preserved.
Unmount the newhome partition now and mount the new root partition as /mnt/newroot.
Copy over the other directories one at a time, eg:

#cd /bin (the old /bin !)
#tar cf - . | (cd /mnt/newroot/bin && tar xBfp -)

That copies over all the files from /bin.

Repeat for the rest of your directories EXCEPT /proc and /mnt, as /proc is virtual, and copying /mnt will lead to a recursive nightmare. Interestingly /dev copies just fine, I was expecting problems with it.

Sometimes I got an error like "tar: ./log: socket ignored", but this didn't matter.

Now your files are in the right places, you need to fix up the /etc/fstab on the new disk to reflect the fact that linux will be running from the new disk. Fix up lilo so it knows about the new disk, and off you go. If you mess up, use lilo to boot your old disk, mount the new one and fix things up on it.

Well, it worked for me, hope it does for you.
 
Old 05-25-2004, 04:56 PM   #6
tsw
Member
 
Registered: May 2004
Location: Colorado
Distribution: Mandrake 10 power-pack
Posts: 74

Original Poster
Rep: Reputation: 15
Quote:
I was wondering why partimage wouldn't restore a partition, and the only thing I could come up with is that it only allows restoring a partition if you have free space left (unpartitioned) in the drives. Was that the case?
Did you take a look at the documentation?
I read a lot that night, perhaps I confused it or maybe confused it later. I do know it was a pretty harrowing time. Damn did I read a lot that night.



Quote:
mount the new home partition as /mnt/newhome
#cd /home (the old home!)
#tar cf - . | (cd /mnt/newhome && tar xBfp -)
This is interesting. I tried a similar method with tar last night. I however got slammed. /usr and /home transfered flawlessly, / on the other hand was all wrong. It was exactly /proc, /sys and a file in /root that effed everything up. The file from /root was actually /root/tmp/root_mapping. It would not tar or cp for that matter.

On the new disk was unable to install the bootloader with the rescue cd. First was a "Fatal raid_setup: stat (dev/hda). Had not much luck in the chroot arena. Then tried a upgrade/rescue (they never work of course) but this time right as the program was about to install "packages" it gives this warning that important packages have been improperly installed and to go to console 2 and check it out. I get to console 2 and ask for the log and the program locked up every time.

Anyway, I was wondering if you had any thoughts on my situation. I think I would like to give it another try. If only to figure out how it is done.

tsw
 
Old 05-25-2004, 05:33 PM   #7
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 52
copy the whole old first disk as it is to the new one in one shot, then play with the
free space. put the drives back like they were. then
dd if=/dev/hda of=/dev/hdb bs=1M # it's faster with the bigger blocks

then put your new drive as the master, and it will boot like your old one.
 
Old 05-25-2004, 09:50 PM   #8
tsw
Member
 
Registered: May 2004
Location: Colorado
Distribution: Mandrake 10 power-pack
Posts: 74

Original Poster
Rep: Reputation: 15
""dd if=/dev/hda of=/dev/hdb bs=1M # it's faster with the bigger blocks""

dd doesn't play nice with reiserfs. It seems to chew up the file system. I learned the hard way.
 
Old 05-26-2004, 03:47 AM   #9
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 52
copying a mounted file filesystem with dd can be risky. i think the kernel denies access to the journal? i don't know. at least sync the filesystem first. i always copy a partition when it is not being used or not mounted. the best way would be to run the command from a rescue cdrom, and make sure the filesystems are unmounted when you do it. that way it will get the journal right.
i do often lazily copy a running filesystem, and i get an error, but it works anyway. the journal may already be on the destination since i am overwriting a previous backup.
 
  


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
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 09:48 AM
Copy hard drive to hard drive linuxnew Linux - Hardware 13 11-28-2005 09:04 PM
Easiest way to copy a boot drive to a new hard drive lsgko Linux - Software 3 05-24-2005 10:38 PM
How to copy ext2fs from failed hard drive to good drive? DogWalker Linux - Hardware 2 08-30-2004 11:52 PM
stuck - trying 2 add 2nd hard drive darazman Linux - Hardware 4 09-13-2003 11:13 PM


All times are GMT -5. The time now is 01:19 PM.

Main Menu
Advertisement
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