moodledata permissions not working correctly

Re: moodledata permissions not working correctly

by Ken Task -
Number of replies: 0
Picture of Particularly helpful Moodlers

I failure happens on my instance which unmounts my moodledata directory. Now I have mounted the directory back, but I couldn't fix the permissions.

On my system ... CentOS 7 ..
Mounted as.            Type.                                 Location
/mnt/disks/data     New Linux Native Filesystem (ext4)     SCSI device B

mount command:
mount -o discard,defaults /dev/disk/by-id/google-data /mnt/disks/data

Have no entry in fstab that would automatically attempt mount upon reboot.
Reason ... since mounting is the last operation on reboot, if it fails, server
un-accessible.  Discovered that on an unfortunate update RedHat had pushed out to protect vs a flaw (now I don't recall what that was! :\). So rather than have an entry in fstab, i have to run a script to mount it.

Mine:
df -h
/dev/sda1        10G  8.3G  1.8G  83% /
/dev/sdb        493G   42G  426G   9% /mnt/disks/data

Yours?

You mentioned you had to remount after loosing it for some reason.

Might review:
https://cloud.google.com/compute/docs/disks/add-persistent-disk

Note there are permissions involved for the entire disk.
chmod a+w /mnt/disks/MOUNT_DIR

Mine:
ls -ld /mnt/disks/data/
drwxrwxrwx root:root

Yours?

So you are saying a PDF file is found, but when downloading and attempting to open it declares an error at that point?

Any filesystem is not beyond corruption ... maybe not total system but only certain files.

Use mysql query to find contenthash and filename for all files in mdl_files table that have a .pdf extenstion.

Use contenthash value to copy a PDF file that normally gives you that error out of moodledata/filedir/xx/yy/contenthashvalue to a humanly recognizable filename (like test.pdf) to apache document root.   URL to it then would be https://yoursite/test.pdf

What happens?

If you cannot open file in browser or whatever application your browser uses to open a PDF, moodle won't be able to fix a corrupted file ... period.

'SoS', Ken