LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How do I swap a hard disk w/o reinstalling? (https://www.linuxquestions.org/questions/linux-hardware-18/how-do-i-swap-a-hard-disk-w-o-reinstalling-21928/)

jkcunningham 05-27-2002 10:36 AM

How do I swap a hard disk w/o reinstalling?
 
I have SuSE 8 installed on a system with two hard disks. One of the hard disks (unfortunately, the one it boots from) is getting flakey and needs to be replaced. Is there a way to move everything off that hard disk to the other (which probably has enough space) so I can take out the bad drive and put in another? I'd rather not do an entire reinstall if I can help it.

Regards

Jeff

Noerr 05-27-2002 02:32 PM

you have several solutions
easy one:
get norton ghost 7.5 (if fs=ext3, otherwise can be older), put it on floppy and boot your system and choose partitions to copy

fun one:
cfdisk/fdisk make partitions you need on new disk + reboot
mkfs /dev/hdb1 .... ( format new partitions)
mount /dev/hdb1 /mnt/newdisk .. (mount new disk to newdir)
if have more partitions make new dirs and mount ie
mkdir /mnt/newdisk/boot
mount /dev/hdb1 /mnt/newdisk/boot ...

cp -a /boot/* /mnt/newdisk/boot/
cp -a /bin /mnt/newdisk/
...

shutdown computer, remove old hard disk and boot with rh i386 disk 1
and prompt choose
linux rescue (your system will be mounted in /mnt/sysimage)
chroot /mnt/sysimage
(if you use lilo) run lilo
(if you use grub) run grub /dev/hda


good luck

ngomong 06-07-2002 06:07 PM

I went through the "fun one" system of moving disks.

However, when I boot with my rescue disk, it says there's a problem mounting my system.

If I try to boot directly, grub reports a hard disk error.

The partitions on my new disk are as follows:
/dev/hda1: /boot
/dev/hda2: swap
/dev/hda3: /

I can mount them by hand, and I've compared all the files between old and new drives... no problems there.

I think it might be a problem with the way I installed grub to the new disk.

Since I couldn't get the rescue disk to mount the new disk... I went back to my old one, put the new disk on /dev/hdb, and did a:
grub-install /dev/hdb

Didn't work.

Used rescue disk, mounted system by hand, did:
grub-install /dev/hda

Didn't work.

Thought it might be because my /boot is on a seperate partition. Did:
grub-install --root-directory=/boot

Didn't work.

Here's the /etc/fstab file from the new disk:
Code:

LABEL=/1                /                      ext3    defaults        1 1
LABEL=/boot1            /boot                  ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                  proc    defaults        0 0
none                    /dev/shm                tmpfs  defaults        0 0
/dev/hda2              swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              iso9660 noauto,owner,kudzu,ro 0 0
/dev/cdrom1            /mnt/cdrom1            iso9660 noauto,owner,kudzu,rw 0 0

I just used the same file as the old disk, and modified it slightly.

Strange thing is, when I mount the system by hand under the rescue environment, "df" reports entries for
/new-disk
/new-disk/boot
... with errors. That's how I mounted my new disk to copy over the files. Not sure why it is showing up under the new environment, since the /etc/fstab doesn't define those mount points.

Where's my problem?

linuxcool 06-08-2002 12:25 AM

ngomong, shouldn't that line, grub-install --root-directory=/boot, be
grub-install --root-directory=/boot /dev/hda.

ngomong 06-09-2002 09:55 PM

Oops... yeah, you're right. I forgot that bit when making my post.

However, I _did_ do it properly when trying to get my disk to work.

I've decided to just use mondo-rescue to image my system, then restore to the new disk.


All times are GMT -5. The time now is 04:59 PM.