Use 2 USB Drives
First USB
Create a LiveUSB (also known as installation USB) of Ubuntu on this USB drive. You will need to use another computer for this task. If you already have a LiveUSB drive you used to install Ubuntu, you can skip this step.
Second USB
This will be your Home backup USB. Make sure you have enough space to keep all your home folders in this USB drive.
Boot from the LiveUSB
Use the Try Ubuntu without installation option to get to the Live session of Ubuntu. This will boot Ubuntu from the LiveUSB.
Mount the internal system partition
Mount the internal disk partition containing your /home
folder. If you don't have a separate /home
partition (standard Ubuntu installations don't) it will be your Ubuntu /
partition.
Easiest way to mount this partition is to use the Disks
application in Ubuntu. Look through each physical drives listed in Disks on the left margin and locate your internal physical drive. Then identify your Ubuntu partition. It will be formatted ext4
.
Highlight the partition and click on the stopped ⬛ icon to turn it into a play ▶ icon. Note down the mountpoint which will look like
/media/ubuntu/<mountpointoftheinternalpartition>
where <mountpointoftheinternalpartition>
is a bunch of letters and numbers.
Insert the second USB into the computer.
Do not unplug the first one to insert the second one! Use a different USB socket.
Copy all your folders and files into the second USB.
You can use Nautlus and drag and drop all the folders if you are the only user of this computer. Or use the command below
If you have multiple users and want to preserve the data of all the users, open a terminal by pressing Ctrl+Alt+T and use a command like:
sudo cp -rp /media/ubuntu/<mountpointoftheinternalpartition>/home /media/ubuntu/USB2TB/home
Make sure /media/ubuntu/USB2TB/home
actually refers to you second USB drive where you intend to copy /home
and /media/ubuntu/<mountpointoftheinternalpartition>/home
actually refers to the /home
folder in your internal drive.
Note: If you have a separate /home
partition you will need to copy the contents of that partition to the second USB with a command like:
sudo cp -rp /media/ubuntu/<mountpointofthehomepartition> /media/ubuntu/USB2TB/home
Eject (Safely Remove) the second USB.
Be patient. If you have a lot of data copied to the USB, it may take a while for the data in the write cashe to be actually written to the USB. Don't lose your data by unplugging the USB too soon.
Install Ubuntu
There is an Install Ubuntu icon in the Live session. You can use it to install Ubuntu after you have safely copied all your important data to the second USB.
Once you have checked the new installation is running properly, you can copy your data from the second USB to your Home folder.
If you have other users and copied all their home data, then follow the instructions in the After Installation section of this answer.
Hope this helps
sudo apt install python3
– oldfred Aug 09 '19 at 19:53