2

I have a hard drive where Ubuntu 22 was installed, but it's not booting anymore, so I want to backup some data. I have a Terraria world on this HDD. I started Ubuntu from stick and now can access the HDD (without having Ubuntu running from this damaged HDD).

Where can I find the files I am looking for?

  • ~/.local/share/Terraria/Worlds/
  • ~/.local/share/

... leads to the stick, but I need this location on the HDD. I also tried to search for the files but didn't find them. It seems like a partition is not mounted?!?

NotTheDr01ds
  • 17,888
Hannes
  • 21

2 Answers2

1

There is a way to access the internal HD to access files (for example in the Home directory like fstab). It would also work with your issue. I used it to fix a broken fstab file on 22.04 LTS on my scratch PC to save reinstalling the OS from scratch.

Using a Ubuntu LiveCD or USB stick to mount the right partition and get the write access you need to cop files off or to repair fstab:

Boot off the CD/USB stick and select the "Try Ubuntu" option.

When it's booted, click on the Dash icon (top icon in the Launcher on the left of the screen).

You need to find and launch a Terminal. The easiest approach is to enter "Terminal" in the search bar that opened when you clicked on the Dash. When the Terminal icon appears, click on it.

Next, hover the mouse cursor over each icon in the Launcher until you find the "Home" or "Files" icon. Click on it and a display of that directory will appear. In the display's left panel, you should see an entry for "File System". Click it. You should see listings for each disk in your machine.

Identify the drive that holds your root "/" directory. (If, for some reason, you put /etc on another drive, find that one, instead.) If you click that entry, the drive will be mounted and opened. (Identifying that drive is easy if you only have a single drive. If you have more than one, the drives are labelled with their storage capacity. That should help you identify the target drive correctly.)

Perform the operation you require.

reference used

graham
  • 10,436
1

I hope @24601's answer works out for you.

If however you get stuck, or find that you need more granular control, here is a bit more elaborate way:


As you and others have noted, even if the disk is connected, the necessary partition (or any partitions on it) may not be mounted yet. You need to find and mount the partition first.

Finding and mounting your partition:

While in your OS booted from your stick, issue the command:

sudo lsblk -o MODEL,NAME

I love this command because this is the only one that will indicate the manufacturer and model of the disk, making it easy to spot in the list; you will see the disk's and its partitions' identifiers as well.

Afterwards you may double-check with:

sudo blkid

This will even show you the manually mountable paths of the partitions — which may look like, e.g. /dev/sda1, or /dev/sdb2, or a derivative of whatever identifier you have found in lsblk's output above.

Now you need to mount it.

First, prepare a suitable mount point:

sudo mkdir /mnt/old-disk-datasave

This will create this directory inside the OS booted from the stick, so it will not survive a reboot, but can assist you in the recovery as long as you don't reboot.

Since /mnt/ is in the file system root of the stick OS (therefore owned by the root user of the stick OS), it may be necessary to transfer your new directory's ownership to your "regular" stick user first; so do:

sudo chown -R $(id -un):$(id -gn) /mnt/old-disk-datasave

Now that the mount point is ready, mount the partition, using the identifier taken from blkid's output:

sudo mount <your/partitionId> /mnt/old-disk-datasave

Now you should be able to open the /mnt/old-disk-datasave directory either in Nautilus (also known as the "Files" app), or in the terminal. If you open it in Nautilus (Files), then you first need to navigate to the root filesystem, designated in Nautilus as "Computer". Therein you will find the "mnt" dir, and within it "old-disk-datasave".

(Reminder: as long as your stick-booted OS is not a system with "persistence", these steps will not survive a reboot; the mounting process will need to be repeated after each boot.)

Now onto your old disk's content:

The ~ at the beginning is a shortcut to the home directory of your regular user on the old, currently dead system. If you haven't customized the location of your home folder on that OS, then it will be at the default location.

This means that you can substitute ~ with /home/<yourOldUsername>/. That will, in a whole, yield the path /home/<yourOldUsername>/.local/share/Terraria/Worlds/. Mind you, the dot at the beginning of ".local/" means that it's a hidden directory; if you are trying to access it via a graphical interface (e.g. Nautilus ("Files")), it might not show up until you instruct your file browser to show hidden items first.

If you want to access this location in the terminal, that would be:

/mnt/old-disk-datasave/home/<yourOldUsername>/.local/share/Terraria/Worlds/

In case of a physically corrupted disk / partition:

The fsck (filesystem check) command can scan and may be able to repair / restore the access to such problematic partitions, but it's also a very powerful tool that shouldn't be taken lightly (in order not to cause accidental data loss).

So I would suggest that if during mounting or accessing the contents of the old disk any data-corruption-related errors would show up — justifying the need for using fsck — ask a new question first, including the exact error-message; optionally leaving a reference about this question as well.

Levente
  • 3,961