Find the answer to your Linux question:
Results 1 to 7 of 7
Id like to move my 120Gb SATA2 disk to a new 500Gb SATA2 disk. I know I must install both disks,boot with my rescue CD and just do a dd ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    12

    Unhappy How can I copy Linux with Windows partitions to bigger disk?


    Id like to move my 120Gb SATA2 disk to a new 500Gb SATA2 disk.
    I know I must install both disks,boot with my rescue CD and just do a dd if=/dev/sda of=/dev/sdb.
    But as disk sizes are different,obviously the copied partition table will not fit correctly in new disk. Ok.I have just made this (putting new disk on same SATA slot old one was) ,and Linux boots,but a partition is not found,and with fdisk i see errors about logical blocks not beggining where it should.
    Is there any way to copy with dd without previously recreating partitions by hand and them copying one by one?
    Thank you!

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Using dd straight from the command line is brave, but old school. Try Clonezillafor this purpose, I highly recommend it.

    Edit: i forgot to mention - BACK UP ANY DATA YOU CARE ABOUT! but you already did that...
    Last edited by atreyu; 12-30-2011 at 09:57 PM. Reason: backup!

  3. #3
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Hello and welcome to the forums!

    Clonezilla (as already suggested) should work just fine, or another option is FSArchiver. I've used both utilities for such purposes and had no problems with either of them.
    oz

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Dec 2011
    Posts
    12
    Thank you for your responses.
    I will try Clonezilla,as suggested.By Im "old schooled" and Id like to understand this. Im curious about how could I proceed with dd.Specially,what operations should i do with the partition tables.

  6. #5
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    i think you can see the dd commands clonezilla is using somehow, don't remember...but anyway, if you do something like

    Code:
    dd if=/dev/sda of=/dev/sdb
    it will get the partition table automatically, b/c it is doing a byte-for-byte copy from the source disk to the destination disk.

    If you just want to copy the partition table, you can do something like this, which will copy the partition table (and MBR) of the source disk to a file:

    Code:
    dd if=/dev/sda bs=512 count=1 of=/tmp/sda-part.dmp

  7. #6
    Just Joined!
    Join Date
    Dec 2011
    Posts
    12
    I used clonezilla to copy disks,but i had to touch a couple of things.Here i put my process in case is of help for somebody.
    After copying with clonezilla, first,I switched SATA disk connectors,so new disk is now /dev/sda and not /dev/sdb as when I used clonezilla to copy all.
    (I could also change boot order on BIOS,but i prefere this)

    This way, when i reboot display info says it has detected two disks,and boots from old one, /dev/sdb.Also my LVM still see two disks with same label,because clonezilla also copied old disk label in new one.(You can see it with pvdisplay)

    As now im using old disk, i can remove /dev/sda (new one) from LVM and change its label
    So I did:

    Code:
    pvremove /dev/sda5
    pvremove /dev/sda8
    so I take new disk /dev/sda partitions out of LVM,and then I add it with

    Code:
    pvcreate /dev/sda8
    pvcreate /dev/sda5
    pvdisplay
    In order to boot from new disk, I put physical disk association in grub,by editing

    /boot/grub/device.map

    so now hd0 points to new disk (/dev/sda) and hd1 is the old one (dev/sdb)

    (fd0) /dev/fd0
    (hd0) /dev/sda
    (hd1) /dev/sdb

    Now, I refresh GRUB and install it in new disk with:

    Code:
    grub-install --recheck /dev/sda
    grub-install /dev/sda
    Finally, I changed /etc/fstab so now my filesystems mount partitions from new disk
    For example:

    /dev/disk/by-id/ata-ST500DM002-1BD142_Z2AF3369-part7 /boot ext4 acl,user_xattr 1 2

    After this,I can reboot from new disk and all looks fine,except by fdisk messages:

    Partition 1 does not start on physical sector boundary. (/dev/sda1 W95 FAT32 (LBA) )
    Partition 5 does not start on physical sector boundary. (Linux LVM )

    Ive read this is not a real problem,but how can I get rid of this?

  8. #7
    Administrator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,864
    Although I cannot help with your problem here, I would like to say thanks for posting your method. I'm sure it'll help someone.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

    I'd rather be lost at the lake than found at home.

Posting Permissions

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