1

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?

  • You can clone the HDD, which is complicated linux.com/learn/tutorials/… but if you tell we what exactly you want to save from your USB install, mabey we can find a way to do a new install and save the data – Mark Kirby Aug 27 '14 at 17:06
  • If you want to clone the drive I will simplify it for you, please make another live USB/DVD so you have two (one to clone and a new one to boot) and boot to this, make sure all three devices are connected (two usb and one HDD) open a terminal and run sudo apt-get install ddrescue and when it finishes run lsblk and add all the output of this to the question. – Mark Kirby Aug 27 '14 at 17:17
  • @markkirby I don't understand. What will that do? I want the Linux install on a partition for dual booting. I don't want to use the whole hard drive. – user1780775 Aug 27 '14 at 18:06
  • You just want a new install in your partitrion ? – Mark Kirby Aug 27 '14 at 18:21
  • @markkirby Yes but I would rather clone the USB stick. I am a little nervous about trying to install to a new partition as I tried to do that in the past and it ended up inadvertently wiping out Windows even though I selected another partition. – user1780775 Aug 27 '14 at 18:31
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.

  • I'm a little bit confused. You are talking about cloning a partition but the Linux install has two partitions and I don't know how they connect to each other. – user1780775 Aug 27 '14 at 18:04
  • Did you install system on pendrive or is it live distribution? If it's a live distro, then there is additional overlay partition and it becomes complicated. In that case I wouldn't recommend cloning, instead I would install new system and copy /etc /home. Use can always check /etc/fstab on pendrive (on running system) and mount overlay partition accordingly) – przemo Aug 27 '14 at 18:11
  • I installed a full system. It has two partitions, both around 7gb in size. – user1780775 Aug 27 '14 at 18:30
  • Could you run your computer from pendrive and paste the output of mount ? – przemo Aug 27 '14 at 19:44
0

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

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.