I would like to transfer my existing Ubuntu Trusty (14.04.1) system (including installed apps from PPAs) to an SSD. I want to retain my existing home directory on hard disk). What is the best method, preferably ones that doesn't involve reinstalling Ubuntu?
Ubuntu – How to transfer Ubuntu to SSD, but keeping home on HDD
14.04ssd
Related Solutions
I actually did this for myself a few months ago. The process is a bit long, and read through the entire thing before you make any decisions as to whether you want to do it or not. You will need to change your registry, and although I have not experienced any problems so far, you may if you don't do everything as I did.
First, set up your partitions in a Ubuntu live disk. Copy all your information to a safe volume in case something happens. Then, wipe all your drives.
Install Windows first. When you create your account during installation, choose a spare account name. It doesn't matter what this name is, except for the fact that it cannot be the name you want to use in the future. I would call it something like "spare."
After installing Windows, create an account with your real account name, but do not log into it yet. Go into regedit, and change all instances of C:/Users to D:/Users (or whatever drive you have your storage on, be it D:, E:, F:, G:, etc. Don't change anything like C:/Users/Administrator, though, only the ones with C:/Users and the ones that would pertain to you.
After doing this load of registry edits, go and restart your computer and log into your new account. If you've done everything right, your new account's profile should be in the drive you had set it to be.
If it is, great. Delete the spare whose account is still on C:/. Do whatever you want on Windows, and after that, install Ubuntu.
I can expect that you can install Ubuntu without any instruction. During installation, I installed my user folder in the normal directory in the same partition as my main installation. I then created symlinks on my user folders by using the commands:
rm -r ./Documents
ln -s /media/Storage/Users/Tyler/Documents ./Documents
rm -r ./Downloads
ln -s /media/Storage/Users/Tyler/Downloads ./Downloads
rm -r ./Music
ln -s /media/Storage/Users/Tyler/Music ./Music
rm -r ./Pictures
ln -s /media/Storage/Users/Tyler/Pictures ./Pictures
rm -r ./Videos
ln -s /media/Storage/Users/Tyler/Videos ./Videos
Tyler is my username on Windows, and Storage is the name of my storage partition.
These commands don't include the templates and the Desktop folder, although I expect that they would be easy to implement.
These symlinks do not have the pretty images, and I have not found a permanent fix for that at this moment. I can set the icon image, but it is reset. I suspect that this is because it needs to mount every time I start up, and that resets the images. I'll post a fix if I find one.
If you want to automount your storage partition upon startup in Ubuntu, you'll need find which partition to mount. In a terminal, use
sudo fdisk -l
You should receive a list of partitions. Mine looks like this.
tyler@Tyler-PC:/$ sudo fdisk -l
[sudo] password for tyler:
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf64a0fce
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 125831167 62914560 7 HPFS/NTFS/exFAT
/dev/sda2 125831168 188745727 31457280 83 Linux
/dev/sda3 188745728 608364543 209809408 7 HPFS/NTFS/exFAT
/dev/sda4 608364544 625141759 8388608 82 Linux swap / Solaris
tyler@Tyler-PC:/$
Search "Startup Applications" and add the command
udisks --mount /dev/sda3
sda3 should be replaced with the one for the disk you have. I had remembered that I had set mine to sda3 when I made my partitions. Also, it is my largest.
After that command, upon startup, you shouldn't need to navigate to your storage partition via nautilus to mount it. I'd only discovered that fix yesterday; as I use Eclipse to develop in Java, needing to mount it via nautilus every time was extremely obnoxious.
Good luck!
The problem with putting /home on a spinning disk is that a bunch of things that could take advantage of the SSD (like all the tiny files your browser uses for example) would be on the HDD instead of the SSD, you can mitigate this by using some symlinks:
- How do I symlink certain directories in /home to an SSD?
- What in /home would benefit from being on an SSD?
In this case, you're probably better off putting all of ~.config
on the SSD. I wouldn't worry about keeping writes to a minimum, newer SSD drives don't have that problem.
Best Answer
When booting from live media, this can be broken down into 3 steps:
Copying the operating system data to the new drive
Before you start, make shure that the new drive has the correct partition table. GPT is (mostly) for EFI and requires a special partition for the bootloader. Don't forget to mark the new operating system partition as bootable on MBR installs.
Using rsync from live media should be the most practical solution to copy the files:
Install the bootloader to the new drive
/dev/sdX
should be changed to the actual device name of the new drive.If you have an EFI installation instead of MBR you should make sure that you booted the live media in EFI mode, ran
sudo apt-get install grub-efi-amd64
, have created an EFI System Partition (ESP) on the new drive and that the ESP is mounted to/media/$mountpoint_of_new_drive/boot/efi
(or use the--efi-directory
option, have a look at the grub-install manpage).Update the configuration
You need to update the UUID in
/etc/fstab
for/
. Get the UUID of the new operating system partition by executingsudo blkid /dev/sdXY
, copy the UUID without quotation marks, runsudo nano /media/$mountpoint_of_new_drive/etc/fstab
and replace the existing UUID in a line that looks like this:But before you replace the line you may want to make a copy of it by pressing Ctrl+K and Ctrl+U. As your home is still on the old drive, the old UUID should be correct and you would just need to update the mountpoint to
/home/$your_username
(replace$your_username
with the name of your user's home directory) and some options (pay attention torelatime,acl
and2
at the end):Save with Ctrl+O and exit with Ctrl+X.
You should think about moving the individual home directories to a separate
home
-partition (it's just a partition with user's home directories mounted as/home
infstab
, you can usesudo rsync -av
again to copy data, see How can I move my /home directory to another partition if it's already part of the / partition?), as you would have to create a new line for each user this way.If you created a new swap partition on the SSD you have to update the UUID for this too:
Additionally you need to update the UUID of the swap partition in
/media/$mountpoint_of_new_drive/etc/initramfs-tools/conf.d/resume
, runsudo update-initramfs -k all -u
after booting from the new drive the first time and reboot to have hibernation working again.Remember to also update the mountpoint for the ESP in fstab too for EFI installs.
Looks complicated, but it's simple to do, just difficult and lengthy to describe in detail.
Troubleshooting
grub-install somehow fails to install with UEFI
Hint: You probably forgot to run
sudo apt-get install grub-efi-amd64
when GRUB says something abouti386-pc
./
) partition including/boot
, right?You copied the content of your ESP? Do that if you havent.
Edit
EFI/ubuntu/grub.cfg
on the new ESP. Replacing the UUID with the UUID of the new root partition should be sufficient, if not change thehd0,gpt2
part from this example accordingly too. This is how the content of file usually looks like:Boot from your old installation, run
sudo update-grub
, os-prober should find the new installation on the other partition and add a GRUB entry.sudo update-grub
here again to update and fix the GRUB configuration on the SSD.efibootmgr -c -d /dev/sdX -p Y -l \EFI\ubuntu\grubx64.efi -L "Ubuntu"
to add the boot loader for new/transferred installation as a new boot option to UEFI NVRAM./dev/sdX
is the device name of the new harddrive,Y
the partition number.