I am using ubuntu 15.10 and run it out of my usb3 stick (which has 2 partitions one / and one swap) I want to migrate my ubuntu installation (not only the programs I installed but all the settings like dual monitor tweaks I have made sound preferences codecs etc) from the usb to a SSD inside my pc (for space purposes)

So to cut the long story short Nothing wil change hardware wise, same monitors same hardware just want to clone ubuntu installation from USB (I installed it normally ton a usb as a hard drive its not a "livecd" running from usb) to my SSD on the same system without loosing my photos,settings,programs

Is there an easy way or to I have to do it the hard way fresh installing it to the SSD then copy paste photos etc then manually redo the settings and manually redownload the packages? both filestystems (on source USB and target SSD) are ext 4


If there is not already any data on the SSD at all, then it is pretty easy: boot the existing install in rescue mode ( choose from the grub boot menu ), and then at the rescue menu, choose the root shell option, then run lsblk to see what disks are what. Identify which one is the existing USB, and which one is your new SSD, and assuming the USB is /dev/sda, and the SSD is /dev/sdb ( adjust the parameters otherwise ), run dd if=/dev/sda of=/dev/sdb to copy everything on the USB to the SSD. You should then be able to shutdown, remove the usb, and boot the SSD and fire up gparted to move/resize your partitions to take advantage of the additional space. Don't try to boot with both disks connected at the same time, as they will have the same UUIDs and this will confuse the system.

If you have data on the SSD already, then it is slightly more complicated. First, create a partition on the SSD to hold your root fs. You don't need to format it. Then boot into rescue mode as above, only instead of copying the entire disk, you need to copy only your root partition. Assuming /dev/sda1 is the existing root, and /dev/sdb3 is the partition on the SSD you want to copy to, run e2image -arp /dev/sda1 /dev/sdb3 to copy the filesystem ( unlike dd, e2image is smart enough to copy only the used parts of the filesystem, and skip the free space, speeding up the process ). After that, run resize2fs /dev/sdb3 to expand the filesystem to use the additional space in the new partition. If /dev/sdb4 is your new swap partition, format it with mkswap -U uuidgoeshere /dev/sdb4. Use the UUID of the old swap partition. Finally, install grub on the SSD so it can boot: grub-install /dev/sdb. After that, shut down, remove the usb stick, and boot from the ssd.

  • Thank you I run ubuntu from DVD and opened a terminal and run dd if=/dev/sdX of=/dev/sdY (were X my USB sd letter and Y my SSD letter so since usb was sdc and ssd was sda I run sudo dd if=/dev/sdc of=/dev/sda) I pluged off my USB didnt even resize the partitions rebooted and IT DID NOT WORK (after loading recovering mode and do everything there was there lik fsck etc I booted to login graphical screen only in lower resolution and without my wall paper and it froze there !!!) after next reboot I only get stuck at a preboot state nomatter what (last lines about fsck returing error 4 and – papajo Apr 5 '16 at 16:24
  • and needed to be run manually.... and the best part? MY USB DOESNT BOOT EITHER!!! I tried to even to fsck using the liveDVD and synced my hardware clock with the actuall time and date nothing.... both installations are useless now and I have to format and install a fresh ubuntu and set it up again... but for the time being I go to a corner lie down try not to cry and cry :') thank you. – papajo Apr 5 '16 at 16:26
  • @papajo, well it certainly should not have messed up the usb, but the hd could be screwed up if you did this from a normal terminal window instead of from a root rescue shell like I said, due to making a copy of the disk while it is still being written to ( at the rescue shell the disk is still mounted read only and so is safe to copy ). – psusi Apr 5 '16 at 21:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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