LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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-31-2010, 05:09 PM   #1
thezerodragon
Member
 
Registered: Apr 2009
Location: Paris, France
Distribution: Fedora 12 Constantine
Posts: 142

Rep: Reputation: 44
Moving install to new hard drive (Fc12) Understanding mount, grub.conf, and rsync


Dear friends,

As my proficiency with Linux improves slowly, I've been trying to find the answers for myself, but in this situation I must admit I find myself rather stumped. I have a perfectly nicely working Fedora 12 install on an 80GB SATA drive, and when it hit an error and wouldn't boot last week (easily fixed with fsck from the initial command line) I panicked and ordered a new 250 GB drive. It got here and I might as well use it, I thought to myself, so I went about trying to figure out how to move my install without having to reset all of my settings, programs and so on. I didn't want to mess with dd because I'm not so so clear on resizing my partitions once the copy is done (if someone thinks this is a better idea I'm open to suggestions.) After some poking around I found this set of instructions which I attempted to follow to the letter, but hit some snags. I understand this thread I am referring to may be a bit outdated, which is why (I assume) I hit a bump here
Code:
# mount /dev/hdy1 /boot
mount returns an error demanding I specify the file system type. At a loss, I barreled on until
Code:
# rpm -ivh --force kernel-version.rpm
whereupon rpm told me I could only force certain things, the kernel version not being one of them. At this point I was really lost, as I was unsure of how to edit Grub.conf . Attempting to run
Code:
Grub-install /dev/sda1
(Yes, the NEW hard drive is showing up as sda, don't ask me why) from a Fedora live CD returned an error message as well.

To summarize, I partitioned and mounted my new drive using fdfisk and the instructions provided above, then used rsync to copy over all of the files, so as far as I know the new drive is ready to go, just not yet bootable. Opening the Grub.conf file in Kwrite (as root) returns a blank page. What do I do now?

As a side note, you can see that I am not too squeamish about the terminal, so I would prefer to find a "command line only" solution to this relatively simple (?) procedure. As always, thanks very much in advance for your time and attention.
 
Old 05-31-2010, 05:32 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
First, the author of the article you referred to used hdx and hdy to represent the first and second drives. X and y are variables which you must edit to substitute the actual drive letters for your system. Example: let's say you have two drives hda and sda; not hdx and hdy.

Second, running "grub-install /dev/sda1" would write the first stage of grub, and the partition table, into the first partition of sda instead of into the MBR of the drive.

You may have to copy it all over again, then run "grub-install /dev/sda" (note that the partition number is not given in the command".

Or, even though you are uncomfortable about using dd, the command "dd of=/dev/hda if=/dev/sda" would copy all of hda to sda (assuming your drives are hda and sda), including the MBR. Afterward, you could use gparted to edit the partition(s) to your liking: resize, make new partitions, etc.

You would then need to edit your BIOS to probe /dev/sda (the new drive) first for a bootable OS,
before probing the old drive.
It would be helpful if you show us the output of "fdisk -l" so that we can see the disks and partitions you have now, as seen by your system.

Last edited by bigrigdriver; 05-31-2010 at 05:37 PM.
 
Old 05-31-2010, 08:18 PM   #3
nbreight
LQ Newbie
 
Registered: May 2010
Distribution: openSUSE 11.2 with KDE 3.5.10
Posts: 12

Rep: Reputation: 1
« command "dd of=/dev/hda if=/dev/sda" would copy all of SDA to HDA (assuming your drives are hda and sda), including the MBR. »

if is the input file, the source.
of is the output file, the destination
unlucky typos, but could really mess up your day.
 
Old 05-31-2010, 09:32 PM   #4
thezerodragon
Member
 
Registered: Apr 2009
Location: Paris, France
Distribution: Fedora 12 Constantine
Posts: 142

Original Poster
Rep: Reputation: 44
Quote:
Originally Posted by bigrigdriver View Post
First, the author of the article you referred to used hdx and hdy to represent the first and second drives. X and y are variables which you must edit to substitute the actual drive letters for your system. Example: let's say you have two drives hda and sda; not hdx and hdy.
I understood this, I just cut and pasted from the source article but the actual commands I issued referred to sda (the new 250 GiB drive) and sdb (the original). Thank you for catching that.

Quote:
Originally Posted by bigrigdriver View Post
Second, running "grub-install /dev/sda1" would write the first stage of grub, and the partition table, into the first partition of sda instead of into the MBR of the drive.
Come to think of it, I'm pretty sure I typed /dev/sda, understanding this command applied to the entire disk. I'm sorry for being misleading with my earlier post. I will try again, just in case I'm wrong here.

Quote:
Originally Posted by bigrigdriver View Post

Or, even though you are uncomfortable about using dd, the command "dd of=/dev/hda if=/dev/sda" would copy all of hda to sda (assuming your drives are hda and sda), including the MBR. Afterward, you could use gparted to edit the partition(s) to your liking: resize, make new partitions, etc.
As I said, I'm not opposed to that solution as long as I can resize the partitions easily using the command line. What tool would I use here? Fdisk?


Quote:
Originally Posted by bigrigdriver View Post
It would be helpful if you show us the output of "fdisk -l" so that we can see the disks and partitions you have now, as seen by your system.
Code:
[root@0080deathscythe ~]# fdisk -l

Disk /dev/sdb: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x41ab2316

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdb2              26        9726    77919263+  8e  Linux LVM

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000803c9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          39      313236   83  Linux
/dev/sda2              40       30401   243882765   83  Linux

Disk /dev/dm-0: 75.8 GB, 75828822016 bytes
255 heads, 63 sectors/track, 9218 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 3959 MB, 3959422976 bytes
255 heads, 63 sectors/track, 481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table

Disk /dev/dm-3: 243.3 GB, 243290603520 bytes
255 heads, 63 sectors/track, 29578 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-3 doesn't contain a valid partition table

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe8900690

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      121601   976760001    7  HPFS/NTFS

Disk /dev/sdd: 4005 MB, 4005560320 bytes
21 heads, 21 sectors/track, 17740 cylinders
Units = cylinders of 441 * 512 = 225792 bytes
Disk identifier: 0xe89
Where sda is the target drive, sdb the source, sdc is an external HDD and sdd is a flash drive. Thanks again for your prompt reply.
 
Old 06-01-2010, 04:01 PM   #5
nbreight
LQ Newbie
 
Registered: May 2010
Distribution: openSUSE 11.2 with KDE 3.5.10
Posts: 12

Rep: Reputation: 1
why not using parted instead of dd?
it has an interactive mode ( -i flag) and can beside creating, formating and labeling partitions also copy the contend of one device / partition to another. not sure in how far the size have to be the same.
 
Old 06-05-2010, 11:23 AM   #6
thezerodragon
Member
 
Registered: Apr 2009
Location: Paris, France
Distribution: Fedora 12 Constantine
Posts: 142

Original Poster
Rep: Reputation: 44
Thanks for all of your help, guys. I would like to remind everyone reading this thread that dd is a very easy command to make critical mistakes with: I transposed "if" and "of" and now this is all a moot point. Starting over again with f13. I know you guys warned me, I don't know how I did it.
 
  


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
Moving files from a Linux hard drive to a Windows Vista Premium hard drive WolfMan51 Linux - Hardware 5 07-12-2011 09:19 AM
Moving my current install to a bigger hard drive vansch76 Linux - Laptop and Netbook 5 02-06-2009 10:58 AM
Moving hard drive with install intact Q.. Linux - Software 3 09-28-2008 10:40 PM
Moving a mount point to a new hard drive koremori@yahoo.com Linux - Hardware 2 02-19-2007 01:15 PM
Moving Hard Drive After Install PiscisBos Linux - Software 2 02-14-2005 12:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06: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