LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 04-01-2007, 02:27 PM   #1
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Rep: Reputation: 31
Transfer data from one HD to the other??


Ok, first some background on what I have. Currently I have a 20GB hard drive that was used to install SuSe 10.2 on. SuSe created (at installation time) three partitions that are:

1. /dev/hda1 (swap ~600MB)
2. /dev/hda2 (/ 7.3GB)
3. /dev/hda3 (/home 10.7GB)

Now I have an 80GB hard drive that I would like to have replace the 20GB. Basically I want to copy all the files from my 20GB onto my 80GB, have it set as bootable and get rid of the 20GB completely. The reason for doing this is I am going to begin running Hardware RAID here soon (Level 1) and want to get rid of the smaller drive and then buy another 80GB drive so that I will have to 80's in the system.

So here are the questions:

1. Do I create the exact same three partitions on my 80GB drive but (obviously) have them created to use the extra space on the 80GB? How big should I make the /home, /, and swap partitions on the 80GB drive??

2. Is it really as easy as copying everything from the 20GB drive over to the 80GB once the three partitions are created? If this is so, do I simply mark the 80GB as bootable after this is done?? Would this work? What copy command would I use to make sure that EVERY file and copied to the 80GB and that all directories and recursive's are intact?

And, finally, does any of this make sense or is there an easier way to transfer files to a new drive than what I am suggesting?

Thanks!!

Rodman
 
Old 04-01-2007, 03:05 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
Here's a thread that's relevant to your question. It's about Debian, so you'll have to take that into consideration. But, the general issue of copying from one disk to another is basically the same. I've learned that it's best to do this copy, while booted from a liveCD.

http://www.linuxquestions.org/questi...15#post2663415
 
Old 04-01-2007, 03:14 PM   #3
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Quakeboy02
Here's a thread that's relevant to your question. It's about Debian, so you'll have to take that into consideration. But, the general issue of copying from one disk to another is basically the same. I've learned that it's best to do this copy, while booted from a liveCD.

http://www.linuxquestions.org/questi...15#post2663415
Just read over it. I wonder if it would be easier to just use Ghost Linux to create a clone. And then tell GRUB to boot from the new Hard drive?
 
Old 04-01-2007, 03:23 PM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
If your "from" partition is the same size as your "to" partition, then you can even use "dd". AwsomeMachine has an excellent thread on the use of "dd" here:

http://www.linuxquestions.org/questi...d.php?t=362506
 
Old 04-01-2007, 03:37 PM   #5
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Quakeboy02
If your "from" partition is the same size as your "to" partition, then you can even use "dd". AwsomeMachine has an excellent thread on the use of "dd" here:

http://www.linuxquestions.org/questi...d.php?t=362506
Well the source is smaller than the target. It appears that dd will still work. If that is the case I just have to figure out how to resize the paritions after dd moves them over to the bigger drive...
 
Old 04-01-2007, 03:45 PM   #6
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
Quote:
Well the source is smaller than the target. It appears that dd will still work. If that is the case I just have to figure out how to resize the paritions after dd moves them over to the bigger drive...
If it's ext2/ext3, then you can try the resize2fs command.
 
Old 04-01-2007, 04:15 PM   #7
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Quakeboy02
If it's ext2/ext3, then you can try the resize2fs command.
Ok, I think this is what I am going to do. I am going to use Ghost or G4U (haven't decided), then am going to try and resize the partitions with resize2fs. Currently, my 80GB hard drive (the target) does not have any partitions defined. Do I need define the three partitions on the 80GB drive or just leave it empty and let Ghost or G4U do the work?
 
Old 04-01-2007, 04:33 PM   #8
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
I've never used them. It would be very helpful, though, if you would report what you did after you get it doing. There is always the next guy who's gonna have the same question.
 
Old 04-01-2007, 04:44 PM   #9
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
dd if=/dev/hda of=/dev/hdb

will copy the entire contents of the older and smaller drive to the new drive, with the exact same structure. The result will be that the new drive is bootable and has the same partition structure as the old drive.

As a consequence of this, you will have a lot of empty space on the back end of the new drive, which you then can partition.

Resize2fs won't help you because this will resize the filesystem, not the partition, and it won't enlarge a filesystem to be larger than the partition.

You won't be able to enlarge hda1 or hda2 because the end of these partitions leads immediately to the start of the subsequent partition, hence there is no space available to enlarge into. You would be able to enlarge hda3 since nothing is at the end of it.

If you wish to enlarge the partitions, your best choice is to just partition the new drive with the partition sizes that you want to have, then use the cp command recursively (or use a window manager's click and drag facility, which turns out to be much faster) to copy all the contents of the old partition to the new partition. You can even do this with the active system partition so long as you block any cron jobs from running and just sit and watch while the copy occurs.

When you have finished all of this copying, copy the bootblock from the old HD to the new HD using dd, exactly like this:

dd if=/dev/hda of=/dev/hdb bs=446 count=1

Pay particular attention to the bs=446; you want to copy exactly the first 446 bytes of the HD, not one less and not one more.

Once you have done this, your new drive will be completely bootable, and will contain the exact information of the old HD except on your new resized partitions.

Last edited by jiml8; 04-01-2007 at 04:46 PM.
 
Old 04-01-2007, 04:53 PM   #10
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Oh, and as an aside...

I generally place swap someplace in the middle of the drive, not at the end. Reason is to minimize average head travel to reach it. Thus, with your organization, I would put it between / and /home.

Last edited by jiml8; 04-01-2007 at 04:54 PM.
 
Old 04-01-2007, 05:09 PM   #11
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by jiml8
Oh, and as an aside...

I generally place swap someplace in the middle of the drive, not at the end. Reason is to minimize average head travel to reach it. Thus, with your organization, I would put it between / and /home.
Wow, Jim, great info!! What is the exact "cp" to use? Something like "cp -arx /dev/hda1 /dev/hdb1"? Then the exact same thing for "/dev/hda2 /dev/hdb2", and "dev/hda3/hdb3"? Or can I use a generic command like "cp -arx /dev/hda /dev/hdb"?

So basically I need go ahead and create three partitions on my new drive with the partition sizes I want (I need mount points correct? Same as those on the old 20GB drive?). I read somewhere that swap should be approx double your ram or so. I have around 300MB of RAM so the swap should be around 600MB? What about the sizes for "/" and "/home"? Any suggestions?

After I create those partitions, I format them, and then I can use a live-cd distro to boot with. I can then cp from hda to hdd. Then, when the copying is finished, I issue
dd if=/dev/hda of=/dev/hdb bs=446 count=1 which will copy the MBR (I'm assuming) to the new drive. Then instead of playing around with GRUB, I can just move the 80GB hard drive to the same connector the 20GB was on so that the system can still boot to /dev/hda without me having to change it to /dev/hdd which is what it is now (Slave on the Secondary IDE channel).
 
Old 04-01-2007, 05:16 PM   #12
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
Do you actually run processes that use the swap space? If not, it doesn't matter where you put it. If you do, then you might consider spending a few bucks and getting more RAM.
 
Old 04-01-2007, 06:14 PM   #13
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Quote:
Originally Posted by Biggen
Wow, Jim, great info!! What is the exact "cp" to use? Something like "cp -arx /dev/hda1 /dev/hdb1"? Then the exact same thing for "/dev/hda2 /dev/hdb2", and "dev/hda3/hdb3"?
Not exactly. You have to have the partitions mounted and refer to them via their mountpoints. I would choose options that clone the files, keeping datestamps and permissions. Don't know offhand which options those are; I'd have to look it up, but you can do that too.

It actually would go quicker to use KDE click and drag for the copies, including the copy of /, because as it turns out KDE does it much faster than cp does.

Quote:
Or can I use a generic command like "cp -arx /dev/hda /dev/hdb"?
no

Quote:
So basically I need go ahead and create three partitions on my new drive with the partition sizes I want (I need mount points correct? Same as those on the old 20GB drive?).
Yes, and yes.

Quote:
I read somewhere that swap should be approx double your ram or so. I have around 300MB of RAM so the swap should be around 600MB?
Just make sure you have enough to keep you out of trouble regardless of what you are doing.

Quote:
What about the sizes for "/" and "/home"? Any suggestions?
As much as you want, and more than you think you need.

Quote:
After I create those partitions, I format them, and then I can use a live-cd distro to boot with. I can then cp from hda to hdd. Then, when the copying is finished, I issue
dd if=/dev/hda of=/dev/hdb bs=446 count=1 which will copy the MBR (I'm assuming) to the new drive. Then instead of playing around with GRUB, I can just move the 80GB hard drive to the same connector the 20GB was on so that the system can still boot to /dev/hda without me having to change it to /dev/hdd which is what it is now (Slave on the Secondary IDE channel).
Skip the live CD distro; you can do it from your running installation on hda2. When you then shut down the machine and move the HDs around, don't forget to change the jumper on the 80 Gig drive.

Last edited by jiml8; 04-01-2007 at 06:30 PM.
 
Old 04-01-2007, 06:17 PM   #14
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Quote:
Originally Posted by Quakeboy02
Do you actually run processes that use the swap space? If not, it doesn't matter where you put it. If you do, then you might consider spending a few bucks and getting more RAM.
I have 1 Gig RAM and 1 Gig swap. I run a linux workstation with a lot of servers running since I use those in my development work. I also run VMWare Workstation with at least one copy and often two or three copies of Windows 2000 up and running.

I can fill any system, and I use a lot of swap. Occasionally, I will close out some apps and disable swap to force everything back into main memory, then reenable swap.
 
Old 04-01-2007, 07:19 PM   #15
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Ok, I fired up Yast2 and went to the partitioner. But there is a problem. I can't have the exact same mount points on a system. When I try to create "/" and "/home" on the second hard drive, Yast tells me "The Mount point is already in use, select another one". This makes since since the linux system uses a filesystem tree rather than drive letters. So I can't create two "/" or two anything elses... Right??

This is becoming more cumbersome than I had hoped. Am I doing something wrong?

I appreciate your help on this, btw. Networking is my thing, not linux file systems... :-(
 
  


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
Bidirectional data transfer ssg14j Linux - Networking 1 10-24-2005 08:59 AM
Data Transfer Dharma_bum07 Linux - Newbie 11 11-26-2004 02:57 PM
Help!! loss of data transfer cabinetcrafter Mandriva 0 05-15-2004 11:42 PM
No data transfer ! shaahul Linux - Hardware 3 09-16-2003 03:08 AM
Data Transfer Woes Evilone Linux - Networking 5 07-11-2003 08:01 AM


All times are GMT -5. The time now is 08:47 AM.

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