Page 1 of 1

New SATA drive - chown is obvious but gibberish to me

Posted: Sat Jun 22, 2019 3:10 pm
by elmarts
Just added a new drive, and its owner is root, so I can do nothing with it. I have partitioned it and formatted it with gparted, and changed its displayed labels with the disks tool. But I do not see any graphical way to grab ownership of the disks. 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/sda5 during installation
UUID=71e07b8c-a134-479d-8d1b-438da18ff997 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=982d2a42-9c69-4262-b5cf-82af5b8ec70e none swap sw 0 0

/dev/disk/by-uuid/2E809C1A809BE71D /mnt/2E809C1A809BE71D auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/5B282A5803110126 /mnt/5B282A5803110126 auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/56F01CF1F01CD957 /mnt/56F01CF1F01CD957 auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-id/wwn-0x50014ee6aecee175-part1 /mnt/wwn-0x50014ee6aecee175-part1 auto nosuid,nodev,nofail,noauto,x-gvfs-show 0 0
/dev/disk/by-id/wwn-0x50014ee6aecee175-part2 /mnt/wwn-0x50014ee6aecee175-part2 auto nosuid,nodev,nofail,noauto,x-gvfs-show 0 0
/dev/disk/by-uuid/20EB30C04E7D01B4 /mnt/20EB30C04E7D01B4 auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/363D179A5F47C759 /mnt/363D179A5F47C759 auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/105462331816116C /mnt/105462331816116C auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/b25ddf96-5606-44a0-8a01-9fdcc846a5cf /mnt/b25ddf96-5606-44a0-8a01-9fdcc846a5cf auto nosuid,nodev,nofail,x-gvfs-show 0 0

where do I go from here?

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sat Jun 22, 2019 4:28 pm
by gittiest personITW
You could try adding
gid=1000
which would give your group access.
for instance
/dev/disk/by-uuid/2E809C1A809BE71D /mnt/2E809C1A809BE71D auto nosuid,nodev,nofail,x-gvfs-show,gid=1000 0 0

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sat Jun 22, 2019 5:17 pm
by all41
You need to take ownership of the mountpoint which is in /mnt
If it is the last drive listed in fstab then:
Copy/Paste the following into a terminal:

Code: Select all

sudo chown -R $USER:$USER /mnt/b25ddf96-5606-44a0-8a01-9fdcc846a5cf
Don't substitute your user name for $USER:$USER, leave that as is

Solved! Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sat Jun 22, 2019 6:59 pm
by elmarts
thank you - that did it. Magical incantations for linux!

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sat Jun 22, 2019 7:39 pm
by all41
Here is how it unfolds:
sudo - allows you to execute actions with root priviledge
chown - is the action=change owner and group
-R - apply the changes recursively to all directories/files contained
$USER:$USER - the new owner will be the currently logged-in owner/group
/mnt/b25ddf96-5606-44a0-8a01-9fdcc846a5cf This is the location and file-name in which to apply the changes.
This info was contained in your fstab file shown in your first post--kudos

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sun Jun 23, 2019 5:31 am
by AndyMH
And you can simplify your fstab by replacing entries like

Code: Select all

/dev/disk/by-uuid/2E809C1A809BE71D
with

Code: Select all

UUID=2E809C1A809BE71D

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Fri Jul 12, 2019 3:03 pm
by elmarts
all41 wrote:
Sat Jun 22, 2019 5:17 pm
You need to take ownership of the mountpoint which is in /mnt
If it is the last drive listed in fstab then:
Copy/Paste the following into a terminal:

Code: Select all

sudo chown -R $USER:$USER /mnt/b25ddf96-5606-44a0-8a01-9fdcc846a5cf
Don't substitute your user name for $USER:$USER, leave that as is
As noted, that worked on the new drive, but in followup, and I don't know how this changed, my previous drive, which I resized some partitions on, now has everything owned by root! So I tried the same incantation

Code: Select all

sudo chown -R $USER:$USER /mnt/363D179A5F47C759
and after a lot of disk activity, no error returned, but it didn't work. Everything is STILL owned by root, even after a reboot. Nevertheless, I can still read/write document files OK, even though the permissions tab says that root is the owner. On the new drive, it says I am the owner, as expected, but the older drive (2 partitions), each mnt partition is owned now by root! I'm lost ...

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Fri Jul 12, 2019 4:04 pm
by AndyMH
I would remove all those 'messy' entries in fstab, presumably created by disks and do it manually. This also means that you can define more useful or meaningful mount points.

If it is an ext4 partition then the entry would be of the form

Code: Select all

UUID=xxx /where_you_want_to_mount ext4 defaults 0 0
where xxx is the UUID of the partition which you find from the output of blkid. Meaningful names - as an example, I used to have an ntfs partition which I shared with win7 in dual boot, in win it was D:, in linux I mounted it as /home/me/data.

If it is an ntfs partition, try the above replacing ext4 with ntfs, but if you find it is read only then use:

Code: Select all

UUID=whatever_it_is /your_mnt_pt ntfs windows_names,uid=1000,gid=1000,defaults 0 0
windows_names just stops linux writing filenames to the partition that windows doesn't understand, the uid and gid bit is assigning ownership of the partition to you.

If your drives are removable you an add the nofail option. This stops linux trying to find the partition if not present (and incurring a 90 second delay in boot). You can choose whether to automount at boot or not (noauto option). The normal convention is that fixed drives/partitions are normally mounted in /mnt and removable drives in /media, but you don't have to. If you do use the 'default' folders you can still use meaningful names like /mnt/mydata instead of /mnt/b25ddf96-5606-44a0-8a01-9fdcc846a5cf.

Suggest you do it one-by-one and check each works instead of changing them all at once.

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Fri Jul 12, 2019 7:49 pm
by Flemur
AndyMH wrote:
Sun Jun 23, 2019 5:31 am
And you can simplify your fstab by replacing entries like

Code: Select all

/dev/disk/by-uuid/2E809C1A809BE71D
with

Code: Select all

UUID=2E809C1A809BE71D
And you can make everything considerably more user-friendly by giving the partitions LABELs (w/gparted, on unmounted partitions). My fstab looks like:

Code: Select all

LABEL=MINT    /          ext4    errors=remount-ro          0 1
LABEL=DATA    /mnt/DATA  ext4    defaults,user,exec,noatime 0 2
LABEL=MANO    /mnt/MANO  ext4    defaults,noauto,user,noatime   0 2

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Fri Jul 12, 2019 8:27 pm
by elmarts
Wow - that is a lot to digest :) The drive in question is formatted NTFS, and has 2 partitions (D & E). My fstab (as noted above) has a bunch of entries that don't seem to correspond to anything physical. Physically, I have 3 SATA drives:
the first is the boot drive partitioned in half, with one half being the win 7 boot (ntfs), and the other being the mint boot (ext4). The second drive now has 2 partitions, both NTFS, in windows they are D: (Games) and E: (data). The third disk is likewise partitioned into 2, one being NTFS (drive F:), and the other EXT4. Now I know that there are tiny bits at the various ends of partitions, but why they end up in /mnt is beyond me. What data can I post that will help me "simplify" my fstab? Thanks all, btw.

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Fri Jul 12, 2019 9:13 pm
by slipstick

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sun Jul 14, 2019 1:56 am
by ricardogroetaers
elmarts wrote:
Sat Jun 22, 2019 3:10 pm
Just added a new drive, and its owner is root, so I can do nothing with it. I have partitioned it and formatted it with gparted .......... here is my fstab
where do I go from here? .......Wow - that is a lot to digest ....... What data can I post that will help me "simplify" my fstab?....
Do not complicate!

To start organizing, post output the commands:
lsblk -f
sudo parted -l

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sun Jul 14, 2019 10:52 am
by elmarts
OK - as follows, although I read that ntfs disks always show root as owner, and don't allow you to change this. Am I just barking up the wrong tree?

sudo parted -l
[sudo] password for ets:
Model: ATA ADATA SP550 (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 32.8kB 120GB 120GB primary ntfs boot
2 120GB 240GB 120GB extended
5 120GB 223GB 103GB logical ext4
6 223GB 240GB 17.1GB logical linux-swap(v1)


Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
3 1049kB 370GB 370GB primary ntfs
2 370GB 1000GB 630GB primary ntfs


Model: ATA Hitachi HUA72107 (scsi)
Disk /dev/sdc: 750GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 411GB 411GB primary ntfs
2 411GB 750GB 339GB primary ext4

lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ntfs Windows 64 bit A0A8882AA88800D0
├─sda2
├─sda5 ext4 71e07b8c-a134-479d-8d1b-438da18ff997 /
└─sda6 swap 982d2a42-9c69-4262-b5cf-82af5b8ec70e [SWAP]
sdb
├─sdb2 ntfs Games 5B282A5803110126 /mnt/5B282A580
└─sdb3 ntfs Data 363D179A5F47C759 /mnt/363D179A5
sdc
├─sdc1 ntfs Drive_F 105462331816116C /mnt/105462331
└─sdc2 ext4 Linux b25ddf96-5606-44a0-8a01-9fdcc846a5cf /mnt/b25ddf96-
sr0

Re: New SATA drive - chown is obvious but gibberish to me

Posted: Sun Jul 14, 2019 5:26 pm
by ricardogroetaers
Excuse me. I forgot to ask for the output of the command:
id