Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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.

  2. #2
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    I would try something like
    mount /dev/hdax /mnt/newdrive 
    cp -Rdp / /mnt/newdrive
    Replaceing hdax with the new drive

  3. #3
    Linux Engineer
    Join Date
    Dec 2002
    New Zealand
    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
    mkdir /mnt/newroot
    mount /dev/hdb1 /mnt/newroot
    mkdir /mnt/newroot/home
    mount /dev/hdb2 /mnt/newroot/home    <--- replace hdb2 with whatever partition is the new /home
    cp -rf / /mnt/newroot
    im pretty sure that will copy everything across.

    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.
    umount /mnt/newroot/home
    umount /mnt/newroot
    mount /dev/hdb2 /mnt/newroot
    check that /mnt/newroot contains the same info as your home drive.
    umount /mnt/newroot
    mount /dev/hdb1 /mnt/newroot
    check that /mnt/newroot contains the same info as ur / drive except home shoudl be empty

    if that all works out then your data has been copied and now we will set the 120gb drive to be bootable.

    mount /dev/hdb2 /mnt/newroot/home
    /sbin/lilo -M /dev/hdb
    now power down your computer, remove the 10gb drive and put the 120gb into primary master plug.

    when u boot up it should look exactly as it always did but u will have a lot more space.

  4. $spacer_open
  5. #4
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    You want to use Rdp with the copy to copy simlinks and keep all the file permissions, owners and such correct. Try man cp

  6. #5
    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!

  7. #6
    Linux Newbie
    Join Date
    Sep 2003
    St.Charles, Missouri, USA
    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.
    Powered by Gentoo
    never ever ever use the hardened option in make.conf!

  8. #7
    Linux Engineer
    Join Date
    Sep 2003
    Knoxhell, TN
    you could also use this:
    dd if=/dev/hdax of=/dev/hdbx
    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/hda1 of=/dev/hdb1
    read the manpage for dd to get some more info on its usage
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  9. #8
    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

  10. #9

    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!

  11. #10
    Linux Engineer
    Join Date
    Dec 2002
    New Zealand
    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
    /dev/hda1 / ext3 defaults 0 0
    /dev/hda2 swap swap defaults 0 0
    after that it should all be fine.

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts