0

The primary drive in my laptop crapped out on me and I didn't have the money to fix it right away. So I decided to ubuntu a portable external drive and use the system as a band aid. I'm not linux proficient, but I've done this 3 or 4 times in a pinch. I've always gone back to windows in the end, but this time I had win10... and I do not want to go back to windows 10. So I tried a little harder to learn this time and for the first time I have an OS that does everything my windows machine could do, and I have grown attached to it. I got my new drive now for my laptop, but I'm wondering... do I have to start from scratch and do it all over again? Or can I transfer the OS somehow?

  • 2
    Noob-friendly? Not really. You are asking to do something very complex, and there are many possible complications. – user535733 Feb 15 '17 at 19:34
  • Maybe it's an option to just take the external drive (you may need to disassemble the case it's in), and then put it in the laptop ? – Jonas Czech Feb 16 '17 at 12:20

3 Answers3

1

You can do this via GUI using Clonzilla.

Create a Clonzilla USB or CDRom and boot to it.

Then follow the prompts to clone device to device. Select your current external drive as the source and the new internal drive as the destination.

After you have completed the clone, it should boot the same way your previous external drive booted.

Once you have verified the functionality, you can use GParted (from the Ubuntu dash search) to resize the partitions to use the full sizes of larger drive.

Alternatively

The most important part is the partition where your Ubuntu is installed. Once you have that partition copied to your new drive, you can simply install Grub on the new drive and have to make it bootable.

There are many messages posted on recovering for failed boots when Windows 10 overwrites the grub boot manager. Once you have the Ubuntu partition of your external drive copied to your internal drive, just install grub on the internal drive for full functionality.

This is an easy method for installing, or reinstalling grub:
https://askubuntu.com/a/877815/29012

L. D. James
  • 25,036
1

Cloning

  1. If the two drives have sectors of the same size, you can clone from the external drive to the new internal drive. You can check the sectors with the following command (with both drives connected),

    sudo parted -ls
    

    The sector size is often 512 bytes.

  2. It is also important to clone to a target drive of at least the same size as the source drive (and I guess this is the case, that your new internal drive is bigger than your external drive).

If these two conditions are satisfied, you can use a cloning tool, for example Clonezilla, which is good if the source drive is big, but far from filled with data (a lot of free space in the partitions). Otherwise, for example if you use a USB pendrive, you can also use mkusb-dus and clone from the source device,

dus /dev/sdx

where x is the drive letter of the source device (drive).

Both tools have menus, where you have an opportunity to check that you are doing the cloning operation in the correct direction.

Borrowed from L. D. James's answer: Once you have verified the functionality, you can use gparted (from the Ubuntu dash search) to resize the partitions to use the full sizes of larger drive.

Do not move the head end of the root partition (left edge in gparted), because then you have to reinstall the bootloader.

See the following links

clonezilla.org

help.ubuntu.com/community/mkusb

Other methods

If cloning is not an option, there are several methods to copy your system to the new drive. I will not describe them in detail or link to them until I know that it is necessary.

But it is actually often as easy or easier to make a fresh installation, where you can reuse the /home directory (create a separate home partition in the target drive, and use it when you install a fresh system. It means that you personal files and 'user tweaks' will be transferred, but you will have to reinstall the program packages, that you installed separately, and you will have to re-do the global tweaks.

In this case you should

  1. Prepare the partition table of the target drive with gparted
  2. Copy the content of the /home partition to what will be the home partition.
  3. Select Something else at the partitioning page of the installer, and select not only the root partition, but also the home partition. Do not format the home partiiton!
sudodus
  • 46,324
  • 5
  • 88
  • 152
1

My 2 cents worth...

I agree with the other two answers... Clonezilla is the best for cloning one disk to another. However, this will only work if the destination disk is larger than the source disk. Even then, it will require manual partition editing using gparted to take maximum advantage of the larger destination disk.

In real life, I believe that the best scenario for you, is to install a fresh Ubuntu on your new internal disk, reinstall any important applications, and then later, copy over any documents/music/pictures/etc from the old external disk, into the /home folder of the new internal disk. You'll be happier in the long run.

heynnema
  • 70,711
  • If my answer was helpful, please vote by clicking the grey up-arrow icon in the upper-left of my answer, and accept my answer by clicking the grey checkmark icon in the upper-left of my answer. Thanks! – heynnema Feb 15 '17 at 19:44
  • Yes, a fresh installation is often the best alternative, why not with the shortcut to reuse the /home directory as a new home partition, as I described under 'Other methods'. – sudodus Feb 15 '17 at 19:54
  • @sudodus because it requires a "noob" to manually lay down the correct partition table, and manually set up root and swap partitions, and even after that, hope that they don't format over an existing /home, and also hoping that there's no owner/permissions issue with anything that did get copied over. Not stuff for a "noob". – heynnema Feb 15 '17 at 19:57
  • The OP has 'done this 3-4 times in a pinch', so not really a noob ;-) – sudodus Feb 15 '17 at 20:00
  • @sudodus I think OP meant that they installed Ubuntu on an external drive 3-4 times and ran that way. Pretty simple for a noob. Gparted, partition tables, root and swap partitions, copying old /home to new /home, are not noob activities. – heynnema Feb 15 '17 at 20:02
  • You may be right. @ Heath Hudson, our OP, will decide which way to go. – sudodus Feb 15 '17 at 20:05