Ubuntu: How to move Linux on a USB stick to a hard drive partition?



Question:

I was running Ubuntu on a USB stick for a while because my hard drive had failed. It had two partitions.

I recently installed a new hard drive and installed Windows on it. I created a new partition inside Windows that is larger than the USB stick.

My question is: how do I move Linux to this partition on the new hard disk so that I have a dual-boot system? I downloaded a program called EaseUS Todo Backup but it can only clone a hard disk onto a hard disk or a partition onto a partition. Ubuntu is installed on the whole USB stick and has two partitions of about equal size.

Does anyone know how to do this?


Solution:1

Try installing Ubuntu and moving home directory to your new system.

If you need to move it and it's a proper installation (not live version) then use

dd bs=4M if=/dev/partition_on_pendrive of=/dev/partition_on_disk

Then chroot into partition you've created and install grub. Don't forget about swap.


Solution:2

i used fsarchiver in SystemrescueCD(www.sysresccd.org).

Steps to backup and restore:

  1. Boot with SystemrescueCD

  2. type fsarchiver probe in terminal to see the devices

  3. to save the Ubuntu 14.04(partition) in /dev/sdb1 as a .fsa file, type the below command in terminal

    $fsarchiver savefs -j2 -o /media/masha/Data/backup/backup/Ubuntu1404.fsa /dev/sdb1

NOTE: use -j2 (dual core) -j4 (quad) to speed up

  1. to restore the Ubuntu 14.04(fsa file) in /dev/sda1(OS partition), type the below command in terminal

    fsarchiver restfs /media/masha/Data/backup/backup/Ubuntu1404.fsa id=0,dest=/dev/sda5

  2. After restoring, open Gparted, select /dev/sda5 and get new uuid.

  3. mount /dev/sda5 using mount /mnt/ubuntu14 /dev/sda5 and update ubuntu14/etc/fstab with new id. And also update mtab file.

  4. if required change host, hostname files.

  5. then restart with ubuntu and update grub using Grub customiser. verify uuid before updating


Solution:3

I use Gparted and boot-repair on a live USB (in many system rescue iso).

Boot with this live USB. Mount your external drive and your internal drive.

With Gparted : Free space for the new primary partition (non logical) on your internal drive. (size > size of the partition on the external drive). Copy-paste the ext4 linux partition of your external drive on your free space created in the internal drive. Wait ... Adjust the size, add partition(s), add swap.

With boot-repair : Update GRUB2.

Reboot (without USB stick and USB external drive).

You'll see grub menu, choose linux. Test the settings of your linux programs. Change in some programs /sdbX (or /sdaX or /sdcX) to /sdaY (Y = your / or /home partiton number). You can also customize the GRUB2 menu with grub-customizer.

Et voilà.

JPol


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »