0

I’m still in the learning stages with Linux. I’m running a virtual server with Ubuntu 22.04 Server. I have a 500GB disk, but I only used 200GB for the boot partition (300GB free). I am logged in as an admin user. Whenever I create a partition using the free space and format it as ext4, it mounts as /media/username/volumename. Other users cannot see that partition.
I want to use this second partition to place mysql databases and website root folders on it, so I need this partition to behave like a system partition (Like having a D: drive in windows).

I have used the “Disks” utility, as well as fdisk/mkfs.ext4 commands. I have run this with sudo, and also logged into terminal as root. I am able to create the partition and access it with the user I was logged in as when I created it, but not other users. Am I going about this the right way?

Rich701
  • 103
  • 3

1 Answers1

2

/media is used to mount external disks.

If you want to mount an internal disk create a mountpoint in either / (the current more accepted method) or /mnt (old school method) and add that and its UUID to /etc/fstab. See for instance How to make partitions mount at startup? on how to do that.

One of the options is to set a user and a group. See for instance How to create a group, add users to the group, and have that user access all folders in files in that directory? Set it up with a new group that holds on your users and do a

sudo chown $USER:{your_new_group} /{mountpoint}

where {your_new_group} is your group and {mountpoint} the mountpoint for the partition. You can also do a

sudo chmod 770 -R /{mountpoint}

to make files executable, if appropriate, for the user and the group.

Rinzwind
  • 309,379