LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 07:25 PM   #16
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116

You are doing something wrong, indeed.

On your new HD, just build the partitions. Then, in your current /mnt, make the mountpoints for the new HD, such as /mnt/hdb2 and so forth.

Then copy the contents from your current / to the appropriate partition on the new HD; for instance cp / /mnt/hdb2.

Don't worry about /home, /, /sys, /mnt, or anything else; just copy the entire contents of one partition to the appropriate replacement on the other drive.

After you have done this and copied the MBR, then shut off the machine, move the HD, and everything will take care of itself. Your new drive which was hdb will be recognized as hda, your mountpoints will all be right, and the system will just boot.

Just make sure that, if you are booting off the second partition on your current boot drive, you copy / to the second partition on the new drive. If you copy / to some other partition on the new drive, then you'll have to edit your copied grub menu.lst to point to the proper partition before moving the drive.

It really does work that way. Think about it.

Last edited by jiml8; 04-01-2007 at 07:30 PM.
 
Old 04-02-2007, 08:45 AM   #17
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
You are doing something wrong, indeed.

On your new HD, just build the partitions. Then, in your current /mnt, make the mountpoints for the new HD, such as /mnt/hdb2 and so forth.

Then copy the contents from your current / to the appropriate partition on the new HD; for instance cp / /mnt/hdb2.

Don't worry about /home, /, /sys, /mnt, or anything else; just copy the entire contents of one partition to the appropriate replacement on the other drive.

After you have done this and copied the MBR, then shut off the machine, move the HD, and everything will take care of itself. Your new drive which was hdb will be recognized as hda, your mountpoints will all be right, and the system will just boot.

Just make sure that, if you are booting off the second partition on your current boot drive, you copy / to the second partition on the new drive. If you copy / to some other partition on the new drive, then you'll have to edit your copied grub menu.lst to point to the proper partition before moving the drive.

It really does work that way. Think about it.
Ok, I think I have a little better understanding of what I am doing now. I created three partitions on hdd (my new drive) to mirror the partitions on hda. hda1 -> hdd1 (swap), hda2 -> hdd2 (/), and finally hda3 -> hdd3 (/home). I was going to put swap in the middle, but for right now I don't want to have to mess with GRUB. I need to get this figured out first.

Mount points were created as follows - hdd1 -> (just swap of course), hdd2 -> (/mnt/hdd2), and hdd3 -> (/mnt/hdd3).

I won't be able to use KDE as I have a video card problem in this machine so I'll have to stick with command line. So I'll have to use the "cp" command. I am pretty sure I want to use "cp -a" as that looks like it preserves time stamps and such.

So when I get to the office this morning I will do a "cp -a / /mnt/hdd2" and then "cp -a /home /mnt/hdd3". Finally I use dd to copy the MBR to the new drive with "dd if=/dev/hda of=/dev/hdb bs=446 count=1".

Shut down the machine, move the drives around so that hdd is now hda and boot up. Everything should work!! I'll report back if all went well! I appreciate your help! If you don't mind looking over this to make sure it all looks good.

Rodman
 
Old 04-02-2007, 09:03 AM   #18
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
that should work. Just be sure you are doing the copy as root. Also don't forget the -r option on the cp so that it will recursively copy directories.
 
Old 04-02-2007, 09:11 AM   #19
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
that should work. Just be sure you are doing the copy as root. Also don't forget the -r option on the cp so that it will recursively copy directories.
One more thing, Jim, before I start it. I know you said that I don't need to use a live distro to boot up and do the copy with. But if anything is written to a directory behind and after cp has copyied it over to hdd, won't I be missing that info? Should I kill crond at least to make sure that isn' running?? Anything else should I kill to try and make sure that I'm not missing anything??

Oh, and it isn't the "-a" option I want, I re-read the man page and it looks like I want "cp -rp". That should do it.

Last edited by Biggen; 04-02-2007 at 09:14 AM.
 
Old 04-02-2007, 09:38 AM   #20
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
In my first post on this thread I stated that killing cron would be a good plan. Not strictly necessary, but if a cron job runs and changes things while you are copying, you will indeed have an inconsistency between copies. Usually this won't matter, but then, it depends on what the cron is doing, now doesn't it.

You can, of course, just use a live CD distro. Me, I usually don't bother.

I commonly backup my / using the dd command to make a partition image. All I ever do is start the backup then go drink a cup of coffee (in other words, I don't touch the mouse or keyboard, stop all multimedia, etc). I never have any trouble, and I usually mount and browse the iso before gzipping it just to be sure it is OK.
 
Old 04-02-2007, 09:55 AM   #21
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
In my first post on this thread I stated that killing cron would be a good plan. Not strictly necessary, but if a cron job runs and changes things while you are copying, you will indeed have an inconsistency between copies. Usually this won't matter, but then, it depends on what the cron is doing, now doesn't it.

You can, of course, just use a live CD distro. Me, I usually don't bother.

I commonly backup my / using the dd command to make a partition image. All I ever do is start the backup then go drink a cup of coffee (in other words, I don't touch the mouse or keyboard, stop all multimedia, etc). I never have any trouble, and I usually mount and browse the iso before gzipping it just to be sure it is OK.
Excellent! I'm downloading a live distro now. Using cp didn't work to well as it gave me errors on some files (i.e. resource busy or permission denied) even running as root. I'm guessing this is becuase those files are currently in use perhaps?? Dunno... I'll report back when I fire it up with the live CD and give it the cp commands then...
 
Old 04-02-2007, 10:35 AM   #22
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Actually, I was just reading up on grub (if that is your bootloader) and I think that probably you'll need to reinstall grub on the new drive after copying it if you use the cp command.

Turns out that the MBR for grub has the absolute physical address of the second stage grub program hardcoded into it. When you use cp to copy the /boot sector from / to the new HD, it seems unlikely that the stage 2 program will wind up in the exact same physical location on the new HD as the old one.

To reinstall grub, after swapping your hard drives boot into either a rescue CD or into a live CD distro. From a shell command line, as root, enter the command: grub

This will give you a command line in the grub program. Enter the command: "root (hd0,1)" (with no quotes). Grub will respond telling you what the file system on the partition is.

Then enter the command "setup (hd0)" . This will cause grub to rewrite the MBR with the proper information.

Then enter the command "exit" to exit grub.
 
Old 04-02-2007, 10:57 AM   #23
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
Actually, I was just reading up on grub (if that is your bootloader) and I think that probably you'll need to reinstall grub on the new drive after copying it if you use the cp command.

Turns out that the MBR for grub has the absolute physical address of the second stage grub program hardcoded into it. When you use cp to copy the /boot sector from / to the new HD, it seems unlikely that the stage 2 program will wind up in the exact same physical location on the new HD as the old one.

To reinstall grub, after swapping your hard drives boot into either a rescue CD or into a live CD distro. From a shell command line, as root, enter the command: grub

This will give you a command line in the grub program. Enter the command: "root (hd0,1)" (with no quotes). Grub will respond telling you what the file system on the partition is.

Then enter the command "setup (hd0)" . This will cause grub to rewrite the MBR with the proper information.

Then enter the command "exit" to exit grub.
Interesting. Ok, here is where I am now. I am finishing up copying "/" to hdd2. Taking a while but that is normal since its a few gigs in size.

I'm still going to need to use dd correct? As in dd if=/dev/hda of=/dev/hdb bs=446 count=1? Or will re-installing grub override this so this isn't necessary?
 
Old 04-02-2007, 11:05 AM   #24
w_r_cromwell
Member
 
Registered: Feb 2006
Location: Michigan
Distribution: RedHat9, Core6, Ubuntu5.1
Posts: 42

Rep: Reputation: 18
Your running system can only have one / and etc just as you said except that you can have more than one swap partition. I have never used ore than one swap partition but it is supposed top be okay (something i found while looking up something else). While the new drive is recognized as hdb you can mount the partitions as anything you like as long as you can remember which partition will be used for each of the original partitions and then copy your files there. After you have done all of your copying and taken care of mbr and moved the jumper on the new drive and plugged it into the appropriate cable the system will recognize it as hda and will mount the partitions according to the instructions it copied over from your first drive (now resting on the shelf). The partitions will be mounted on the same mount points that were used for them in the original system. The mount points are determined by the running system and not by what was used when the drive was recognized as hdb.

Bill

PS: Do I feel silly or what! I missed the whole second page of replies before I posted this. I'll leave it here anyway.

Last edited by w_r_cromwell; 04-02-2007 at 11:09 AM.
 
Old 04-02-2007, 12:06 PM   #25
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
reinstalling grub will write the proper MBR. Hence you won't have to copy the old one using dd.
 
Old 04-02-2007, 01:33 PM   #26
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
reinstalling grub will write the proper MBR. Hence you won't have to copy the old one using dd.
Ok, I reinstalled GRUB and everything seemed to go just fine. I Then rebooted and everything looked like it was going well until I got to:

Quote:
fsck.ext3: No such file or directory while trying to open /dev/hdd3
fsck.ext3 /dev/hdd3 failed (status 0x8) Run manually
fsck failed for at least one filesystem (not /)
Please repair manually and reboot
It looks as if something is trying to access a hard drive at hdd. Now when I partioned the drive using Yast2, it automatically added mount points in FSTAB I believe (/mnt/hdd2) and (/mnt/hdd3). I wonder if this is causing the problem. I wonder if removing any entries to hdd from FSTAB would fix this...
 
Old 04-02-2007, 01:48 PM   #27
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
It worked!!!

Jiml8, if you were close by I'd take you out for a beer!! :-)

I had to end up deleting the entries in the fstab as Yast2 added them automatically when it formatted the drive. Went just as easily as you said, re-installing GRUB was a breeze with your instructions.

Thanks a lot man. Now as soon as my other 80GB drive comes in I can setup RAID 1 in the system. I'm going to be doing hardware RAID so it should be farily simple to set that up (I hope anyway!).

Thanks again, bud!
 
Old 04-02-2007, 01:52 PM   #28
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Now as soon as my other 80GB drive comes in I can setup RAID 1 in the system. I'm going to be doing hardware RAID so it should be farily simple to set that up (I hope anyway!).
Are you buying a RAID controller? The one on your motherboard is a sofware raid.
 
Old 04-02-2007, 02:06 PM   #29
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
Are you buying a RAID controller? The one on your motherboard is a sofware raid.
I bought one from 3Ware. From all the research I've done, setting up software RAID looked like a total pain in the ass. From what I have read, hardware RAID is much easier as it is transparent to Linux...
 
Old 04-02-2007, 02:52 PM   #30
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
I am in phoenix az and I love beer.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

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