Switching Hard Drives
I have Suse 8.1 running on an older 10G drive and have just added a new 120G drive that I would like to use as my main drive... meaning I want to transfer everything from the old drive including all config files, system files, etc.
I continue reading several sites about this process but seem to not be getting anywhere. They are not very complete.
I dont want extra partitions just the standard /, /boot, and /swap partitions.
If anyone could please guide me through this that would be much appreciated.
I would try something like
Replaceing hdax with the new drive
mount /dev/hdax /mnt/newdrive
cp -Rdp / /mnt/newdrive
let me get this straight.
u have hda which has / , /home, swap right? this driev is 10gb all up
u have hdb which is completely empty, and is 120gb.
and u want to copy everything off the 10gb onto the 120. then remove the 10 and have it behave as it always did?
first u need to format/partition hdb. use ur favourite partiionaing tool for this, i assume suse comes with something, if it doesnt ive heard parted works pretty well.
think carefully before partiioning hdb, do u want it to be say 10gb /, 1gb swap, 109gb /home or do u want to make /home another 10gb and make the last 100 of the drive another partiion called /storage or something... i will leave this up to u.
for the rest of this i will assuem u are going with what i first suggested.
now u have ur partiions, and they are all formatted (again the partition tools can do this), format / and /home to ext3/resiserfs/xfs/whatever ur favourtie is, i would do ext3. and the swap partition to linux swap format.
type the followign stuff into a terminal
im pretty sure that will copy everything across.
mount /dev/hdb1 /mnt/newroot
mount /dev/hdb2 /mnt/newroot/home <--- replace hdb2 with whatever partition is the new /home
cp -rf / /mnt/newroot
now to set up ur 120gb to be bootable.
first check that /etc/lilo.conf is set up so that root=/dev/hda1 for everything. The reason for this is that while the 120gb is currently hdb, we will later remove the 10gb drive and place the 120 on hda.
now check that /mnt/newroot/etc/fstab is set to mount /dev/hda1 on / and /dev/hda2 on /home (again replace the number at the end by the partition u installed onto.)
-yes this should still be hda NOT hdb.
now we will check that it all copied properly, since we are abotu to make the 10gb drive obsolete.
check that /mnt/newroot contains the same info as your home drive.
mount /dev/hdb2 /mnt/newroot
check that /mnt/newroot contains the same info as ur / drive except home shoudl be empty
mount /dev/hdb1 /mnt/newroot
if that all works out then your data has been copied and now we will set the 120gb drive to be bootable.
now power down your computer, remove the 10gb drive and put the 120gb into primary master plug.
mount /dev/hdb2 /mnt/newroot/home
/sbin/lilo -M /dev/hdb
when u boot up it should look exactly as it always did but u will have a lot more space.
You want to use Rdp with the copy to copy simlinks and keep all the file permissions, owners and such correct. Try man cp
I dont think I'm using LILO for booting... I can't find the /etc/lilo.conf. file so think I'm booting from grub. What if this is the case?
Also when I check my current partition table it shows the following:
/dev/hda1 ext2 /boot
/dev/hda3 reiserfs /
Should I only make one partition on the new drive? Or do I have to partition it as the second is setup? Do I create a /boot partition or is this just simply a mount point?
Thanks for your help!
You could take the easy way andformat hdb as one partition. There (in my opinion) is no reason for multiple part. unless you want to mount /boot as read only. That way copying would be alot easyer.
you could also use this:
where both occurrences of 'x' refer to the partitions on each drive that you are working with.. so, if you have / on /dev/hda1 and you want to copy it to /dev/hdb1, do this:
dd if=/dev/hdax of=/dev/hdbx
read the manpage for dd to get some more info on its usage
dd if=/dev/hda1 of=/dev/hdb1
Thanks, but not one damn thing has worked!!
I damn near got locked out of both my drives trying this stuff!!
I guess I'm not as linux savvy as I thought.
Maybe I need a person to person tech help or something...
Thanks for all your help people
Good news...I hope
Well I have finally done it!
Thanks to all that helped me out!
Now here is my second issue..
I'm getting a few FAILED on the system startup now having to do with the /swap partition.. which by the way, I did not make.. All I did was create one large partition on the new drive and the rest was done automatically.
Here is what my fstab file looks like:
/dev/hda3 / reiserfs defaults 0 0
/dev/hda1 /boot ext2 defaults 0 0
/dev/hda2 swap swap pri=42 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
proc /proc proc defaults 0 0
usbdevfs /proc/bus/usb usbdevfs noauto 0 0
/dev/hdd4 /media/zip auto noauto,user 0 0
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
/dev/fd0 /media/floppy auto noauto,user,sync 0 0
Im not sure if this looks funny or not, but it seems like it might not be right?
If you guys/girls could continue helping me out that would be great! I'm not ready to reformat my old drive yet until I get this last issue settled.
BTW: its going into my old mac 6500PPC taking the place of the old 3G drive. As it is making really scarry noises and is about to go out!
ok heres another of my pointlessly long posts.
i guess ur old drive is out and the new one is on pri mast. (hda)
u need a swap partition somewhere
and i have always belevied in putting /home on a difefrent partition than everything else so that it wont get wiped if i format part of the disk.
mount this big partition somewhere so u can modfiy fstab and other stuff
boot off ur installation cd and get to a rescue prompt or somethign similar, u probably have to use fdisk to do partitioing from here. make a swap partition (twice ur ram or up to a max of 1gb)
What format did u make this 1 big partition, i will use ext3 for example purposes.
comment out the first line by puttign # at the start
change line 2 and 3 to
after that it should all be fine.
/dev/hda1 / ext3 defaults 0 0
/dev/hda2 swap swap defaults 0 0
if u take my advice and put /home on a seperate partition, make a empty directory for it and a line
/dev/hda4 /home ext3 defaults 0 0
in /etc/fstab, again replace hda4 with whatever partition is goign to be home
the error is probably coming up either coz it wants a swap fiel and doesnt have 1, or coz fstab specifies to mount it but its not there.