Ubuntu migrate from HDD to SSD
My old HP becomes quite rusty so I want to add an SSD alongside the HDD, but I don't won't to lose all my data.
I would like to transfer all the application and root folders to the SSD so the OS will boot from it. However, the /home
directory should remain on the HDD because is to large for the SSD.
I'm not a newbie in Linux, but I certainly don't have enough experience to accomplish the task.
So I would like if someone could make a detailed guide on how to do it. The workflow should roughly be something as follow:
- Create a back up so I can always revert all the changes
- Migrate from the SSD to the HDD (selecting a file system, linking the home dir, BIOS settings etc.)
- Updating from Ubuntu 18.04 to the latest version
EDIT
Here is the lsblk /dev/sda
(HDD) output (the SSD is not plugged yet):
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931,5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 923,1G 0 part /
└─sda3 8:3 0 8G 0 part [SWAP]
this might not be the go-to way to do it but here is what I would do:
- Create a backup using timeshift on an external drive. I find it to be the best backup solution out there and I trust it because I have done this procedure using it dozens of times.
You can install it using these instructions
After that just follow the GUI instructions to create a backup of all your files. Create a second one if you want to be absolutely safe.
Put the SSD into your laptop and take the HDD out
Install the Linux Distro of your choice.
Install timeshift in that Distro
Recover the data.
Enjoy.
Please read first to the end. For this procedure it would be better to be disconnected from the internet.
The SSD must not be smaller than the old hard disk. A USB adapter cable for an SSD costs about 20-30 €. Then you could take over the data with:
Plug your SSD to adapter and then USB cable to your Linux machine.
In case the old hard disk is /dev/sda
(source disk) and the SSD
is /dev/sdb
(target disk).
(Check yourself which drive is where. You could look after with GParted.)
Type in terminal:
sudo su
As root then do in terminal :
dd if=/dev/sda of=/dev/sdb
Command dd is secure and stable.
dd
makes here a 1 to 1 copy of your hard disk to your SSD, when both have the size of 1 TB or when the SSD is bigger than 1TB - then free space stays free. dd is even backing up the deleted files on the old hard disk to the SSD, so you could recover them on the SSD.
This lasts a longer while, because of USB with it doing we say 20 or 30 MB each second.
It could last 1 to 3 hours.
A backup of old hard disk to new hard disk is working the same. And the new hard disk as target must not be smaller than the old hard disk as source.