LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Make 1:1 copy of disk in odd situation (https://www.linuxquestions.org/questions/linux-software-2/make-1-1-copy-of-disk-in-odd-situation-609779/)

tomazN 12-29-2007 04:05 AM

Make 1:1 copy of disk in odd situation
 
Hi all.

Let me describe my odd problem.

I have a 120GB IDE hdd on which there is a 2GB swap partition and other space is for linux / partition. This hdd was in use for years, not i became loud and i want to migrate to a never hdd.

So i bough a WD Raptor 74GB 10.000Rpm, on which i would like to put my system, offcourse same as on that IDE drive, so i would like just to copy it to new drive. Old one is bigger but there is only 30GB space used on the /. So 74GB new drive will be big enough.

I tried with dd, offcourse it did not work, because new drive not being the same. Tried paragon disk copy, it copied nicely all the data and made some kind of partition resizing. It did not boot, and when i done fcsk on / it worked for about 4 hours and then hangs as well, probably that program did not make as good job as i though he did.

Tried to do a quick install of open suse 10.2 and then just cp -R -f */new, where /new being the new os drive with basic opensuse install just so i got MBR and partitions. There is a problem with file ownership then, and MBR not working etc.

So what are my options,*or*better*said*what*is*the*recipe*to*get*this*working ?

Thanx.

aus9 12-29-2007 07:18 AM

1) I assume you know how to set jumpers on second drive.

2) my suggestion is run a live cd....the smallest one to d/load is RIP at around 80Megs....which has a application called gparted on it and an image app called partimage.

b) use live cd to create 4 primary partitions using gparted or fdisk or cfdisk etc on new drive

/.....(must be equal or larger in size than old drive)
/spare
/image (must be large enough for at least one image)
swap

gparted can format....I think suse is ext3

c) use live cd to image old partition and pretending your drives are master old/slave new

open a shell
su
mkdir /z
mount -t ext3 /dev/hdb3 /z

change hdb (slave) to hdc if new drive is master on second controller etc

then run partimage but you are saving partition 1 of old drive

file name to save
/z/image1.gz

will write an image to 3rd partition of new drive

d) turn off computer...use an antistatic wrist strap or ground the back of your hand on powersupply b4 removing old drive and resetting new drive to jumper as master

e) reboot with live cd
open a shell
su
mkdir /z
mount -t ext3 /dev/hda3 /z

hda is because new drive is now jumpered as master on first controller

mext run partimage but restore partition 1 using file
/z/image1.gz.000

exit partimage and staying in shell

grub
root (hd0,0)
setup (hd0)
quit

will install grub into mbr of new drive

aus9 12-29-2007 07:19 AM

get RIP if you do not have a good live cd here
http://www.tux.org/pub/people/kent-r...looplinux/rip/

jlinkels 12-29-2007 07:22 AM

I give you a quick summary of what to do. Details are everywhere on the Internet.

1. Partition the new drive in a way similar to the old one. You should have enough space for putting the contents of each old partition.

2. Tar each partition (tar -cvf hda7.tar <partition>) Put the root dir for a partition in place of <partition> Say /var is on its own partition, then do tar -cvf hda7.tar /var/ In case of doubt "man tar"

3. Copy each tar file to the new disk

4. Mount the partitions of the new disk so you can access them

4. Do an tar -xvf for each tar file, extracting files on the right partitions

5. chroot to the root partition on the new disk. Run grub install. Check the grub manual to be sure what parameters to pass, where to install the MBR

This is not the quickest way, but has always worked for me. It is less error prone than dd because you are really copying on file level. No games with byte-by-byte copying of partition tables etc. You should only be alert that you mount the new partitions and extract the tar files in the correct location.

jlinkels


All times are GMT -5. The time now is 07:32 AM.