Migrating from live USB to internal HDD

Tech Notes

So now I need to clone my live USB install of Ubuntu to an internal HDD.

  1. Install HDD drive
  2. Boot from live Ubuntu CD
  3. Create partitions. Use the builtin Disk Utility in System > Administration > Disk Utility Create 256MB swap (0.256 GB) Create the remainer as Linux EXT4. Set EXT4 to bootable.
  4. Install gddrescue sudo aptitude install gddrescue
  5. Plug in the USB drive and unmount it
  6. Determine which is the source and which is the destination sudo fdisk -l
  7. Copy the contents from source to dest sudo ddrescue -v /dev/sda1 /dev/sdb2 This messes with the partition table - so we fake a resize.
  8. Expand the clone to fill the partition Use gparted from System > Administration > GParted and Partition > Resize / Move. Fiddle around shrinking and enlarging the partition. Get GParted to update the table even though it complains that nothing will change.
  9. Repair Grub2 (Method 3 - CHROOT) https://help.ubuntu.com/community/Grub2
  10. While chrooted edit /etc/fstab to enable swap /dev/sdb1 none swap sw 0 0
  11. Reboot and test. You might find that what was sdb is now sda - so update fstab swap and root entries.