Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 14744  / 2 Years ago, sun, october 2, 2022, 6:15:30

I have set up 16.04 manually and have now two partitions (ext4). My second (and bigger) partition can be written at only by root. Now when I hit sudo su in the terminal and input my password, I'm still forbidden access to the folder. I actually think I messed up the partition process... My goal was to have two partitions, one for Ubuntu and one for my data. But now everything is on the same (small) partition.



After sudo parted -l, I get:



Festplatte  /dev/sda:  500GB  
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos
Disk-Flags:

Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 15,7GB 15,7GB primary ext4 boot
3 15,7GB 496GB 480GB primary ext4
2 496GB 500GB 4223MB extended
5 496GB 500GB 4223MB logical linux-swap(v1)


3 is the one with the problem.



From mount | grep 'media/johanna/home', I get:



/dev/sda3 on /media/johanna/home type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

More From » 16.04

 Answers
3

First create a mount-point:



sudo mkdir /media/data


Change the ownership of the mount-point:



sudo chown johanna: /media/data


Set the permissions:



sudo chmod 755 /media/data


Now open the fstab-file:



sudo nano /etc/fstab


Add the following line at the end of the file:



/dev/sda3  /media/data  ext4 defaults  0  2


Press Ctrl+o and then hit Enter



Press Ctrl+x



Close the terminal and reboot. You will be able to write to your mounted partition now without root-privileges.



Note



On german keyboards the Ctrl-key should be the left Strg-key.



Explanation



It looks like you mounted the partition via the desktop-icon or opening the partition in the file-manager. Doing so will automatically create the directory /media/<username>/<partition-name>, the partition-name might be the label of the partition (if one exists) or the UUID of the partition.



This automatically created folder should be owned by and you should have read- and write-permissions, but mysteriously this doesn't seems to be the case. Also, this folder will be removed as soon as the partition is unmounted, if you don't unmount the partition yourself, the partition will be unmounted whenever the system shuts down. This explains that any changes (ownership, permissions) will not survive a reboot.



To ship around this we create a directory which we use as mount-point, adjust ownership and permissions of the directory and at last we add an entry to the fstab-file, so the partition will be auto-mounted at start-up. This directory is not going to be removed when the partition is unmounted.



Addition



I also have the impression that you wanted to set up your installation with a separate /home-partition. It seems you created the partition, but you didn't specify the mount-point (which would be /home) during installation. As the result you got a system with your system-partition and a big, but empty partition. Don't worry, you still can achieve this by copying the contents of the /home-folder to the partition and after doing so changing the mount-point of the partition to /home, here is a nice "How to do that":



https://help.ubuntu.com/community/Partitioning/Home/Moving


[#11388] Monday, October 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ionash

Total Points: 214
Total Questions: 111
Total Answers: 116

Location: Sudan
Member since Thu, May 7, 2020
4 Years ago
;