Announcement

Collapse
No announcement yet.

How to migrate an Ubuntu partition to a NEW HDD

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to migrate an Ubuntu partition to a NEW HDD

    Hi guys.

    I need your help and assistance on the following:

    I have Kubuntu version 16.04 in a Dual boot with Windows 7 and I'd like to MIGRATE ONLY my Ubuntu partition to a new SSD drive and be able after to BOOT Kubuntu on my NEW SSD? Is this doable and if YES what would be the best steps to go for

    Thank you very much for your help in advance

    Best,

    #2
    Doable? Yes. Worth it? Maybe not. Generally, a new install is so easy it's not worth the trouble to copy one.

    Anyway, assuming you're using EXT4 (and not a better filesystem) you can use copy (cp) or rsync to completely copy one filesystem to another. If the partition on the new drive has the EXACT same size as the older one you can use dd to make a clone.

    sudo cp -ax SOURCE TARGET

    sudo rsync -avxHAX --progress SOURCE TARGET

    sudo dd if=SOURCE_PARTITION of=TARGET_PARTITON


    Personally, I wouldn't try this unless I was booted to a liveUSB and had mounted both the SOURCE and TARGET filesystems somewhere. With dd mounting the partitions isn't required.

    Be careful and good luck.

    Please Read Me

    Comment


      #3
      If you do clone the install, be sure to understand the UUIDs that are used, and adjust the /etc/fstab and grub accordingly. If you clone the partition with something like clonezilla or gparted make sure that their UUIDs are different; sudo blkid will list them. gparted can set a new one.

      It's easy (I did it!) to copy the install then wish to check that it works before destroying the old, without setting a new UUID, and get yourself and the computer very confused.

      Having a super grub bootable stick (or disc) available is a good idea; using it to boot into the copy of the install, then running grub-install from it would sort grub out. Without that, in theory you could chroot into the copy and run update-grub.

      If the 16.04 install was upgraded from a previous version, doing a fresh install might have benefits; 14.10, 15.04 and 15.10 were trials for me.
      Regards, John Little

      Comment


        #4
        @jlittle: Great point on the UUIDs. I haven't done this in so long it slipped my mind. I've been using btrfs and subvolumes so long now I'm used to all my installs having the same UUID.

        Please Read Me

        Comment


          #5
          Using dd with the default block size (bs=1024. IIRC) will take tens of hours to do for an installation that is hundreds of GB in size. A clean install will take less than 30 minutes, plus an hour or two to add the additional apps and data.

          I can't remember if I was using dd or cp at the time, but when I tried to copy a partition to make a backup the sockets and links (hard and soft) threw errors and interrupted the process.

          Now, btrfs makes such operations trivial.


          Sent from my iPhone using Tapatalk
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            Hi @oshunluvr​and all,

            Thanks a bunch for taking the time to share your valuable inputs and as well the ways to go about it. Will take the time to re-think and see if I'm ready to go with all the trouble that might occur. Again a big thanks for taking the time ;-)

            Best

            Comment

            Working...
            X