Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hi all, i bought a larger ATA HD for my laptop and thought about doing a dd from old to new HD and save much work. My question is: what ...
  1. #1
    oxy
    oxy is offline
    Just Joined!
    Join Date
    Feb 2008
    Posts
    35

    dd copy entire HD. And the boot sector?

    Hi all,
    i bought a larger ATA HD for my laptop and thought about doing a
    dd from old to new HD and save much work. My question is:

    what about the boot sector?

    Would a dd be possible if i connect the new HD through an external HD
    case with USB to the computer?

    What tips can u guys give me about that?

    Thanx a lot ...

  2. #2
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    dd don't suitable for moving the system to a larger hdd .
    You can only copy equal sized partitions with dd.

    If you have only one partition for everything i suggest you copy the old partition with cp

    Make a partition on the new hdd
    mount the new hdd for example
    mount /mnt/newhdd
    than

    copy everything from oldhdd to newhdd if you are using your current system to move your system to another hdd , don't copy /dev /proc only
    create /dev and /proc on newhdd
    Code:
    mkdir /mnt/newhdd/dev
    mkdir /mnt/newhdd/proc
    now you must reinstall the bootloader
    Code:
    mount --bind /dev /mnt/newhdd/dev
    mount -t proc /mnt/newhdd/proc
    
    chroot to newhdd
    chroot /mnt/newhdd  
    
    now you are in you system
    
    install bootloader.

    Reboot with your new disk

    done.

  3. #3
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    Virtualize a Server with Minimal Downtime

    I used this to move from a physical to virtual. it should work for this and it doesn't matter what size the hd is.

  4. #4
    oxy
    oxy is offline
    Just Joined!
    Join Date
    Feb 2008
    Posts
    35
    I thought about doing that from a life CD.
    I boot from a life CD,
    copy everything from HDD to an external HD,
    shutdown, connect the new HDD,
    boot from life CD and
    copy everything back from external HD to local HDD.

    So u mean there is no problem doing all that with a simple "cp -pr" ?
    Files like /etc/fstab will not match the system anymore (??)

    And how would be the easiest way to install a boot loader?
    I have some ideas but a 2nd opinion would be nice.
    Thanx a lot ...

  5. #5
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    if you want do this with a live cd mount all the two hdd and than copy the old to the new with cp -a.

    /etc/fstab will match if you don't change the partition structure.

    For installing the bootloader dowhat I said before.
    bind your current dev dir into the new hdds dev dir and mount proc filesystem than chroot into the system in the new hdd. You can easily install your bootloader.

  6. #6
    Just Joined!
    Join Date
    Oct 2008
    Posts
    14
    Getting in to the habit of using 'cp -a' to copy disks will get you in to trouble. It _does_ copy the file data but does _not_ make the disks the same.
    You will miss some inportant details which will cause your Linux distro to be very unstable.
    See <<http://www.halfgaar.net/backing-up-unix>> for some guidance.

    Your best bet is to use GNU TAR to transfer the data from one partition to another.

    This is an example of how to use TAR:

    tar -cf - --one-file-system | (cd /mnt/newpart ; tar -xvf - )

  7. #7
    oxy
    oxy is offline
    Just Joined!
    Join Date
    Feb 2008
    Posts
    35
    ok, tar sounds like a good option.

    But there is still sth i did not understand:
    what did iwanabeguru mean with
    /etc/fstab will match if you don't change the partition structure.
    I want to store the data in an external HDD, then plug the new HDD
    and pull everything back. It seems hard to keep any partition structure
    through the operation, even if the data is split in the same partitioning
    order at the final HDD. Sounds like my idea wont work.

    I can find an external USB-plugged case for 2.5in-HDD and connect the
    new HDD through it and transfere the data in a direct way
    (old HDD to new HDD directly).
    But i still do not understand how /etc/fstab will address the /dev files
    to the filesystem mount points correctly, if they have different sizes
    (everything is actually different in a new HDD...)
    Could u tell me a bit about that or give a reference?

  8. #8
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    You can dd small drive to a larger one, and then resize partitions with gparted live cd.

  9. #9
    oxy
    oxy is offline
    Just Joined!
    Join Date
    Feb 2008
    Posts
    35
    Just to be sure, the BSD disklabel scheme is the right one, right?

  10. #10
    oxy
    oxy is offline
    Just Joined!
    Join Date
    Feb 2008
    Posts
    35

    fdisk basic X fdisk expert

    hi,
    trying to make an exactly equal partiton table in the new HDD,
    i check the old HDD with fdisk:

    Code:
    # fdisk /dev/hda
    Command (m for help): p
    
    Disk /dev/hda: 40.0 GB, 40007761920 bytes
    255 heads, 63 sectors/track, 4864 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *           1         851     6835626   83  Linux
    /dev/hda2             852        4864    32234422+   5  Extended
    /dev/hda5             852        1024     1389591   82  Linux swap / Solaris
    /dev/hda6            1025        4864    30844768+  83  Linux
    and then i try the same in expert mode ...

    Code:
    Command (m for help): x
    Expert command (m for help): p
    
    Disk /dev/hda: 255 heads, 63 sectors, 4864 cylinders
    
    Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
     1 80   1   1    0 254  63  850         63   13671252 83
     2 00   0   1  851 254  63 1023   13671315   64468845 05
     3 00   0   0    0   0   0    0          0          0 00
     4 00   0   0    0   0   0    0          0          0 00
     5 00   1   1  851 254  63 1023         63    2779182 82
     6 00 254  63 1023 254  63 1023         63   61689537 83
    fdisk basic tell the 1st partition end at cyl 851 and fdisk expert
    tells it end at cyl 851. Further incongruences are seen for the
    other partitions.

    Partition 3 and 4 from expert mode were created and erased at
    the 1st install procedure. Do i have to create them with zero
    dimention in the new HDD?

    thanx for any tip ...

Page 1 of 2 1 2 LastLast

Posting Permissions

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