Score:2

How to access files of my First Ubuntu from my Second Ubuntu

sg flag

Edit: Ubuntu version is 20.04 LTS

Sorry for the bad Title, I don't know actually how to say it or what terms to use .

So I broke my ubuntu while just playing around. I was unable to boot.

Then I installed Ubuntu in side of previous Ubuntu by making another partition in my hard drive.

So my main Question is How can I use my newly installed Ubuntu to access files in my previous Ubuntu. When I tried opening that home folder it was showing empty. Because other users don't have permission to access files.

How can I give myself permission to access and edit files.

I can login in my first Ubuntu using CLI.

Please help me

Edit: I have two Ubuntus 20.04 LTS installed in same hard drive in different partition, just like people use windows and linux side by side together.

David avatar
cn flag
What version of Ubuntu? What did you do to kill the first install? Then I installed Ubuntu in side of previous Ubuntu by making another partition in my hard drive. Do you mean you installed another copy of Ubuntu on the same hard drive? Is it the same version as the one already there?
Asmit avatar
sg flag
@David I added that info in my question. Please have a look
WinEunuuchs2Unix avatar
in flag
This answer: [How to manually mount a partition](https://askubuntu.com/questions/1029040/how-to-manually-mount-a-partition/1029041#1029041) is the same as answer posted below but in much more depth and even a script to automate the process.
Score:5
jp flag

If you can determine the partition number using lsblk you could mount the drive and directly access it there. Example:

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda         259:0    0 476.9G  0 disk 
├─sda1      259:1    0   512M  0 part /boot/efi
└─sda2      259:2    0 476.4G  0 part
└─sda3      259:3    0 476.4G  0 part /
$ udisksctl mount -b /dev/sda2

In this (hypothetical) example, sda2 is a partition that currently is not mounted. It could thus be your system partition of the previous Ubuntu installation. Partitions on internal drives are not automounted, unless they are explicitly configured to be so. This will mount your drive in a folder under /media/<your user name>, so navigating there and clicking the folder where the partition is there will show its contents.

You can also use the the "traditional" mount command, but then you need to be root:

$ sudo mount /dev/sda2 /mnt

This mounts the partition under the /mnt folder.

vanadium avatar
cn flag
That will not work. Only root can mount by default.
Asmit avatar
sg flag
Yeah I can access it now, thanks
ned300889 avatar
jp flag
"Then I installed Ubuntu in side of previous Ubuntu by making another partition in my hard drive." This sounds like they have one working distro with root access, you can just modify the above and prepend root to any command needing privilege escalation. Log in on second Ubuntu install, elevate privileges, check for drive partition then mount the drive.
Asmit avatar
sg flag
@vanadium I am the root on my second partition, I am not a second standard user, its completely different Ubuntu
vanadium avatar
cn flag
You are not root. You are a user with root permissions. root account is not active in a default Ubuntu install. So precede the "mount" command with "sudo" to execute it with root permissions.
ned300889 avatar
jp flag
@vanadium updated the answer to reflect this, i didn't feel the need to expand the scope of the answer however felt it was best to clarify and update commands to ensure they're quick copy and paste for anyone in the future.
Zanna avatar
kr flag
There is an option to mount a drive without root - `udisksctl mount -b /dev/sda2` should work (and automatically create a mountpoint) cc @vanadium
vanadium avatar
cn flag
@Zanna Thank you! I will add that to the answer!
vanadium avatar
cn flag
@ned300889 added some more substantial info on how to "recognize" the lacking partition. If you do not agree, feel free to not accept the edit.
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.