Score:0

Ownership of External Drive on Ubuntu Server

ne flag

I am having a lot of trouble with a Western Digital 6TB external drive since I've first used in a year or so ago.

To begin with, I was getting into the world of servers and was making use of an old laptop with Ubuntu Server OS mainly for just hosting a Plex media server. All of that media is on this external drive. To begin with, I used my Windows computer to copy many of the several terabytes of media, but once I mounted it to Ubuntu it will only allow ownership to be root.

I have recently learned a lot more about servers and picked up a used Dell Precision Workstation and had a fresh install of Ubuntu Server 22.04.2 LTS and tried mounting it to user and not root, but still have the same issue. I have other internal and external drives and drive pools that I can change ownership whenever and permissions the same way.

I have looked at all of the questions where some people are not familiar with how to change permissions or ownerships, but I have tried all different ways. I have tried to change permissions and ownerships with the drive mounted and unmounted. I would really like to be able to change the ownership so that I can use it through Samba like my other drives or even SFTP. I will put some information below that might be helpful if anyone has any ideas.

Another fun fact is that the Server won't boot into the OS while the drive is plugged in (and yes I have checked for any boot flags on the partitions), so I have to plug it in after the server OS boots.

$ blkid /dev/sdm1 (Output):

/dev/sdm1: LABEL="My Book" UUID="E01F-6997" BLOCK_SIZE="512" TYPE="exfat" PARTLABEL="My Book" PARTUUID="ace84bbc-8a6d-462b-b543-0f5f65457510"

$ df -H (Output):

    Filesystem      Size  Used Avail Use% Mounted on
tmpfs           3.4G  5.1M  3.4G   1% /run
/dev/sda2       983G  717G  216G  77% /
tmpfs            17G  189k   17G   1% /dev/shm
tmpfs           5.3M     0  5.3M   0% /run/lock
tmpfs            17G     0   17G   0% /run/qemu
External2Pool   8.2T  1.4T  6.5T  17% /mnt/ext2Pool
/dev/sdi1       738G   29k  700G   1% /mnt/ePool5
/dev/sdj1       984G   29k  934G   1% /mnt/ePool7
/dev/sde1       2.0T  286G  1.6T  16% /mnt/ePool1
/dev/sdg1       984G   29k  934G   1% /mnt/ePool2
/dev/sdh1       2.0T  300G  1.6T  17% /mnt/ePool3
/dev/sdk1       245G   29k  233G   1% /mnt/ePool6
/dev/sdl1       314G   29k  298G   1% /mnt/ePool4
/dev/sda1       1.2G  6.4M  1.2G   1% /boot/efi
/dev/sdf1       2.1T  1.7T  306G  85% /mnt/JoDrive
tmpfs           3.4G   25k  3.4G   1% /run/user/1000
/dev/sdb1       984G  321M  934G   1% /mnt/iPool1
/dev/sdc1       984G  321M  934G   1% /mnt/iPool2
/dev/sdd1       492G   29k  467G   1% /mnt/iPool3
Internal2Pool   2.5T  642M  2.4T   1% /mnt/int2Pool
/dev/sdm1       6.1T  5.4T  638G  90% /mnt/MAIN

$ fdisk /dev/sdm (Output):

Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


[?2004hCommand (m for help): p
[?2004l
Disk /dev/sdm: 5.46 TiB, 6001174511616 bytes, 11721043968 sectors
Disk model: My Book 25ED    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3FA9CA38-7310-44E6-8972-1B2B5B8FC0DC

Device     Start         End     Sectors  Size Type
/dev/sdm1   2048 11721041919 11721039872  5.5T Linux filesystem

Here is my fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/4b40d9bb-a2cb-48d7-84db-1f193caab897 / ext4 defaults 0 1
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/CF6E-0CFC /boot/efi vfat defaults 0 1
/swap.img   none    swap    sw  0   0


##### Original Plex Media Disks #######################################################

# Mom's Drive (2TB)
UUID=66728AB8728A8C8D   /mnt/JoDrive    ntfs    defaults,nofail 0   0

# Media Drive (6TB)
UUID=E01F-6997  /mnt/MAIN   exfat   defaults,nofail 0   0


##### (OLD) Drives for ePool (External) #######################################################

# My Storage Drive 1
UUID=4bcd5ddf-92b8-4c57-a359-c081f43a33e8   /mnt/ePool1      ext4    defaults,nofail    0   0

# Storage Drive 2
UUID=4b974804-1c20-43bc-b857-c9fa42b75e7b   /mnt/ePool2 ext4    defaults,nofail     0   0

# Storage Drive 3
UUID=ae7418f3-d555-4f63-a4bf-cb1d74b9468b   /mnt/ePool3 ext4    defaults,nofail     0   0

# My Storage Drive 4
UUID=d2495930-ee12-462b-be34-bc29a120bce6   /mnt/ePool4 ext4    defaults,nofail     0   0

# Storage Drive 5
UUID=e256781d-0ecc-4074-a0d9-6ba92751e7e6   /mnt/ePool5 ext4    defaults,nofail     0   0

# Storage Drive 6
UUID=bcd2f4a6-39f8-4ba9-aecf-48f42c5308b9   /mnt/ePool6 ext4    defaults,nofail     0   0

# Storage Drive 7
UUID=e13ccb83-e65a-46f6-8320-4e5b7cd49e38   /mnt/ePool7 ext4    defaults,nofail     0   0

##### Disks for iPool (Internal) ##############################################

# Internal Drive Storage (1TB)
UUID=eaea4e5b-b9b0-45fe-8ffe-e1b3edfab434   /mnt/iPool1 ext4    defaults,nofail 0   0


# Internal Drive Storage 2 (1TB)
UUID=6ae3d2df-651b-438e-91b4-170377ca89ea   /mnt/iPool2 ext4    defaults,nofail 0   0

# Internal Drive Storage 3 (500GB)
UUID=9bf0af4b-dcf3-48f6-8dae-d2bbb06f4737   /mnt/iPool3 ext4    defaults,nofail 0   0


##### Pools ##################################################################

# External Drive Pool
/mnt/ePool* /mnt/ext2Pool   fuse.mergerfs   cache.files=auto-full,dropcacheonclose=true,category.create=mfs,moveonenospc=true,minfreespace=10G,fsname=External2Pool,nonempty    0   0


# Internal Drive Pool
/mnt/iPool* /mnt/int2Pool   fuse.mergerfs   cache.files=auto-full,dropcacheonclose=true,category.create=mfs,moveonenospc=true,minfreespace=10G,fsname=Internal2Pool,nonempty    0   0




####################################################################

# Internal Drive Pool

#/mnt/iPool*    /mnt/5iPool fuse.mergerfs   cache.files=auto-full,dropcacheonclose=true,category.create=mfs,moveonenospc=true,minfreespace=10G,fsname=Internal2Pool,nonempty    0   0



# (OLd) Internal Drisk Pool
#/mnt/iPool*    /mnt/int3Pool   fuse.mergerfs   cache.files=auto-full,dropcacheonclose=true,category.create=mfs,moveonenospc=true,minfreespace=5G,fsname=Internal3Pool,nonempty 0   0

Thanks in advance to anyone that has the answer, and if any more information is needed please let me know.

waltinator avatar
it flag
Read `man mount fstab`. There is a section on mounting XFAT volumes. One can specify the UID, GID, and other Linux concepts that filesystems from Windows don't support.
sudodus avatar
jp flag
[This link](https://askubuntu.com/questions/11840/how-do-i-use-chmod-on-an-ntfs-or-fat32-partition/956072#956072) may help you mount your drive with suitable permissions and ownership. You can expect that the same mount options work for NTFS, FAT32 and exFAT file systems.
oldfred avatar
cn flag
Best not to use exFAT for large drive. Default ownership is always root and permissions are set with mount to allow use. The standard exFAT implementation is not journaled and only uses a single file allocation table and free space map. But exFAT will store larger files than FAT32. But still should not be used for larger partitions as chkdsk may take forever. And it does not have Linux ownership & permissions.
Jake avatar
ne flag
Thanks so much for the help, and I'm sorry for the late response. I didn't intentionally format the drive to exfat, I would've liked to have it formatted to ntfs since I was going to initially use it between windows and linux systems, I was ignorant and thought the drive would've came formatted to ntfs and did not check and then added almost 5TB of files and media and couldn't change at that point. I will look into setting the UID and GID in fstab, although I did try to set it to users and it made no difference, I do admit I'm no expert at configuring fstab so I probably missed something.
sudodus avatar
jp flag
@Jake, you can *either* use the command `mount` like described in the link from my previous comment, *or* use `/etc/fstab` with a line with the corresponding mount options in 'field #4'. See also [this link](https://askubuntu.com/questions/974954/how-can-i-make-sure-that-my-hard-drive-is-correctly-mounted-so-that-backup-works/974967#974967). Good luck :-)
I sit in a Tesla and translated this thread with Ai:

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.