Score:0

How to backup from Ubuntu bootable usb?

gt flag

I have a problem when booting Ubuntu 19.10 on my laptop, I would just like to do a fresh install instead of solving the problem but before I do that there are a couple of important folders I need to backup. How do I do that with a Ubuntu bootable USB?

I created the USB and tried following a tutorial I found but I am at a loss of what to do. I clicked on "try Ubuntu" and then "files" then "other locations" then on what I think is my hard disk (called 496 GB volume, /dev/sda1) and when I click on it there's a series of folders.

Photo of folders

How can I access my actual folders/files?

Please be patient, I am not good with this kind of stuff and desperate to recover some of my files. Thank you in advance for any help.

ubuntu@ubuntu:~$ lsblk -f

NAME FSTYPE LABEL UUID                                 FSAVAIL            FSUSE% MOUNTPOINT
loop0
 squash                                                  0   100% /rofs
loop1
 squash                                                  0   100% /snap/core
loop2
 squash                                                  0   100% /snap/gnom
loop3
 squash                                                  0   100% /snap/gtk-
loop4
 squash                                                  0   100% /snap/snap
loop5
 squash                                                  0   100% /snap/snap
sda                                                                   
├─sda1
│    ext4         557b262e-78a6-45b2-8b7d-78888556eef8    269G    36% /media/ubu
├─sda2
│                                                                     
└─sda5
 swap         98a60c88-d7e6-4e22-bc56-74d4f02a3552                [SWAP]
sdb  isw_ra                                                           
└─sdb1
                                                                  
sdc  iso966 Ubuntu 20.04.2.0 LTS amd64
│                 2021-02-09-19-06-26-00                              
├─sdc1
│    iso966 Ubuntu 20.04.2.0 LTS amd64
│                 2021-02-09-19-06-26-00                     0   100% /cdrom
├─sdc2
│    vfat         54C5-9C6C                                           
└─sdc3
 ext4   writable
              fc191471-2528-4a5c-a090-359ad18ffd0b     11G     0% /var/crash

ubuntu@ubuntu:~$ lsblk -m

NAME     SIZE OWNER GROUP MODE
loop0      2G root  disk  brw-rw----
loop1   55.5M root  disk  brw-rw----
loop2    219M root  disk  brw-rw----
loop3   64.8M root  disk  brw-rw----
loop4     51M root  disk  brw-rw----
loop5   31.1M root  disk  brw-rw----
sda    465.8G root  disk  brw-rw----
├─sda1 461.9G root  disk  brw-rw----
├─sda2     1K root  disk  brw-rw----
└─sda5   3.9G root  disk  brw-rw----
sdb     29.8G root  disk  brw-rw----
└─sdb1     4G root  disk  brw-rw----
sdc     14.6G root  disk  brw-rw----
├─sdc1   2.7G root  disk  brw-rw----
├─sdc2   3.9M root  disk  brw-rw----
└─sdc3  11.9G root  disk  brw-rw----
sudodus avatar
jp flag
You should backup to a third location (for example an [external] hard disk drive), while booting from the USB drive and reading from the internal drive. Identify the directory trees that you want to backup and write them to the third location. I prefer command line tools like `rsync` or `tar` from a terminal window, but you may prefer a tool with a graphical user interface. Please be aware that you may need elevated permissions (`sudo`), if you want to backup files, that your regular user cannot access, or if you want to preserve settings files including their permissions.
Mona0000 avatar
gt flag
First of all thank you for taking the time to read my post.
Mona0000 avatar
gt flag
Secondly I have inserted a second usb where I can backup the files, but my current problem is that I don't understand how to access the files from the folders in the photo I posted originally. It's a folder that was on my desktop and one that was in my home that I need to copy, but I don't understand how to get to them from that folders in the photo.
user535733 avatar
cn flag
Left-hand side, bottom of the menu. Click on "Other Locations". Since you will have three independent storage devices, two of which have complete filesystems, it may be easy to get lost if you are not paying close attention. If something doesn't seem quite right, it means that you are probably looking at the wrong storage device.
Mona0000 avatar
gt flag
When I click on other locations and then on the laptop's disk, it opens a window with a series of folders (the photo that is in the OP), I don't understand how to get from there to my files.
sudodus avatar
jp flag
Is there a separate **home** partition in your internal drive? In that case look for that in 'Other locations'. Otherwise there should be a clickable icon for 'home' in the picture that you uploaded. - If still no luck, please run the following commands from a terminal window: `lsblk -f` and `lsblk -m` and copy & paste to put the output text into your original question. Indent each line four spaces to render it as`code`.
Mona0000 avatar
gt flag
I didn't create partitions when I first installed ubuntu, and can't see a folder named home in other locations or among the folders in the photo..I will run the commands and update the OP with the results
sudodus avatar
jp flag
The screenshot and the output of `lsblk` indicate that `/dev/sda1` is the root partition of the internal drive. But the home directory seems to be missing. How come? Could it be in some other drive, that is not connected now, or did you remove (delete) it by mistake?
sudodus avatar
jp flag
In case you removed the home directory of your installed system, and if you are lucky, you might be able to recover some files (the content) but not the file names (unless stored also inside the file content) and not the directories. This could be done with **PhotoRec**. With a bit more luck you might be able to recover also some file names and directory structure with **TestDisk**. Both programs come from **[cgsecurity](https://www.cgsecurity.org/)**. I don't know, but **let us hope that someone else can help you** find your home directory with the important data, that you want to save.
Mona0000 avatar
gt flag
Thank you for your help so far! I don't think I removed the home directory, maybe the fact that is missing is due to the error that I get when booting? That says "error attempt to read or write outside of disk hd0" then press any key to continue and then the command (?) initramfs appears.. it happened randomly when I booted my laptop this morning :(
Mona0000 avatar
gt flag
So my home directory is missing? But the files are still there? Because it says that some space is occupied on the disk. So hopefully I can still recover it somehow
sudodus avatar
jp flag
1. When booted from a live USB drive with Ubuntu you can try to repair the file system (in /dev/sda1). See [this link](https://askubuntu.com/questions/1344517/is-it-a-problem-if-i-have-one-bad-sector-on-my-hdd) (all answers) and links from it (for example in my answer); 2. If this does not help, you can try TestDisk and if that does not help you can try PhotoRec according to my previous comment. This is difficult and may or may not work; 3. If no luck please see this as a reminder to set up a **backup routine** to avoid loss of data in the future. Similar things have happened to many of us.
Score:1
ca flag

There are several ways to do this but also on the newly fresh install you can prepare the system so you will not need to do this again.
In the standard installation Ubuntu creates only one partition for / (root filesystem) and everything goes there.

Your data is always in /home/<your_username>, and you can copy from there to the usb drive.

Now, in your newly fresh install, instead of user your entire hard driver for one partition, I recommend to have at least three.

  • on for / (root filesystem), 100G-120G size is more than enough
  • on for swap (2 x ram size will work)
  • on for /home (most of you data), rest of the disk if you want

when you tell ubuntu to create/change these partitions you alos specify if they need to be formated or not.

Now, in future reinstalls you won need to reformat your /home partition and just reuse it.

It is a also safe practice to write a log file with the changes you are doing to your system (in my case I have a bash shell script to restore the system to where I was left of so I can recover my system in an hour or so).

Let me know if this helps.

regards.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.