Jump to content

Download with disconnected HDD


eph77341

Recommended Posts

eph77341

Hello!
I have a question about the download function and synchronization with an external HDD. 

I have set up the download for unseen media, which works fine so far. However, the HDD is not always connected to the server, but synchronization is a scheduled task. 

I now had the problem that the system partition was full. Is this due to an incorrect configuration of the download or does the problem always occur when no medium is connected?

The HDD is also smaller than what is to be synchronized...

My solution to the problem was to delete the files manually with SSH access, but I would like to avoid this in future... 

Edited by eph77341
Link to comment
Share on other sites

eph77341

I think that there are temp files from the Media which should be synced. 

Link to comment
Share on other sites

eph77341
root@Diskstation:~# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/md0                2.3G  2.2G   48K 100% /
devtmpfs                7.9G     0  7.9G   0% /dev
tmpfs                   7.9G  364K  7.9G   1% /dev/shm
tmpfs                   7.9G   34M  7.9G   1% /run
tmpfs                   7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs                   7.9G  1.2M  7.9G   1% /tmp
tmpfs                   1.6G     0  1.6G   0% /run/user/196791
root@Diskstation:~# du -xhd 1 /
1.1M    /.log.junior
40K     /.old_patch_info
16K     /root
4.0K    /lost+found
16K     /opt
4.0K    /.system_info
192M    /var
4.0K    /mnt
8.2M    /etc
2.5M    /etc.defaults
32M     /.syno
4.0K    /initrd
1.1G    /usr
861M    /volumeUSB1
9.5M    /var.defaults
2.2G    /

I deleted the files in /volumeUSB1/usbshare/Emby/Videos. 

Link to comment
Share on other sites

eph77341

When adding my external HDD its mounted as /volumeUSB1/usbshare. On this HDD i created folder Emby which is the destination for download. There emby created automatically the folder Videos. 

What you See in my reply is the root device of my Synology without connected HDD. So emby thinks it writes on the HDD but is filling my System partition. 

Edited by eph77341
Link to comment
Share on other sites

Sorry I'm having a hard time following this. What files were in /volumeUSB1/usbshare/Emby/Videos ?

Link to comment
Share on other sites

eph77341

Okay, let me try to explain:

I connect an external HDD to my Synology with is shown in Synology-Filestation as "usbshare". On this drive there is a folder called "Emby". Then I created "USB_BACKUP" with path "/volumeUSB1/usbshare/Emby" in FolderSync in Emby.

image.png.255b09998d1c6c8866421cb3a41ab3ac.png

After that I created a download job for my collection where I want to sync the unseen movies to my HDD. 

image.thumb.png.154d0488b345792ded4cc2e75991506a.png

When my HDD is connected everything works fine (except deleting seen movies on the HDD, but this is a different problem).

But now I disconnet the HDD so "usbshare" is no longer shown in Synology-Filestation. When now the job for syncing is running Emby doesn't check if there is the HDD to write on but uses the path "/volumeUSB1/usbshare/Emby". But without connected HDD this path is on my System-Partition which is only 2GB of space.

This is before i start the job for download (without connected HDD): There is a folder "/volumeUSB1" in the root directory of Synology, but it's empty.

root@Diskstation:~# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/md0                2.3G  1.4G  858M  62% /
devtmpfs                7.9G     0  7.9G   0% /dev
tmpfs                   7.9G  244K  7.9G   1% /dev/shm
tmpfs                   7.9G   20M  7.9G   1% /run
tmpfs                   7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs                   7.9G  968K  7.9G   1% /tmp
tmpfs                   1.6G     0  1.6G   0% /run/user/196791
/dev/mapper/cachedev_0   21T   16T  5.6T  74% /volume1
root@Diskstation:~# du -xhd 1 /
1.3M    /.log.junior
40K     /.old_patch_info
16K     /root
4.0K    /lost+found
16K     /opt
4.0K    /.system_info
194M    /var
4.0K    /mnt
8.2M    /etc
2.5M    /etc.defaults
32M     /.syno
4.0K    /initrd
1.1G    /usr
12K     /volumeUSB1
9.5M    /var.defaults
1.4G    /

And after that you can see that Emby writes in the folder on Synology system-partition:

root@Diskstation:~# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/md0                2.3G  2.2G     0 100% /
devtmpfs                7.9G     0  7.9G   0% /dev
tmpfs                   7.9G  244K  7.9G   1% /dev/shm
tmpfs                   7.9G   20M  7.9G   1% /run
tmpfs                   7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs                   7.9G  968K  7.9G   1% /tmp
tmpfs                   1.6G     0  1.6G   0% /run/user/196791
/dev/mapper/cachedev_0   21T   16T  5.6T  74% /volume1
root@Diskstation:~# du -xhd 1 /
1.3M    /.log.junior
40K     /.old_patch_info
16K     /root
4.0K    /lost+found
16K     /opt
4.0K    /.system_info
194M    /var
4.0K    /mnt
8.2M    /etc
2.5M    /etc.defaults
32M     /.syno
4.0K    /initrd
1.1G    /usr
858M    /volumeUSB1
9.5M    /var.defaults
2.2G    /

Now i have to delete files in this folder manually to clear space:

image.png.dc6dcaa467e510a88534e0bda5b1a06b.png

Is it now clear?

Link to comment
Share on other sites

Q-Droid

Is the path for the external storage always going to be /volumeUSB1/usbshare/Emby/Videos or at least /volumeUSB1/usbshare/Emby?

The problem is that Emby can access the path /volumeUSB1/usbshare whether or not the external drive is mounted because it always exists as the mount point. 

Unless @Luke has another idea what I think you could do is make sure that /volumeUSB1/usbshare (on the system volume) is clean, no subdirectories or files then set the permissions so that Emby can read and navigate but not write or create in that path. When the external HDD is mounted then make sure that Emby can only write/create/modify in the /volumeUSB1/usbshare/Emby directory. This way if the HDD is not mounted then Emby should throw an error because it can't download to that destination.

 

Link to comment
Share on other sites

So you’re saying the same folder path could map to two different places depending on whether the hdd is active or not?

 If you can reconfigure it to produce an error when the hdd is not active then I think that will resolve your issue.

Link to comment
Share on other sites

eph77341
root@Diskstation:~# cd /volumeUSB1/usbshare
root@Diskstation:/volumeUSB1/usbshare# ls -l
total 4
drwxr-xr-x 3 emby emby 4096 Feb  5 07:40 Emby

So this is folder usbshare should not be writeable by emby? Do you know how to change this?

root@Diskstation:/volumeUSB1/usbshare# cd /volumeUSB1/usbshare/Emby
root@Diskstation:/volumeUSB1/usbshare/Emby# ls -l
total 4
drwxr-xr-x 2 emby emby 4096 Feb  5 07:43 Videos

And this folder Emby within usbshare can stay as it is?

Link to comment
Share on other sites

Q-Droid

Run a df -h as above with the HDD mounted to show the mount point.

Unmount the external HDD first then check ownership and permissions on that path. Also make sure there are no other subdirectories in the path below the mount point while the HDD is unmounted.

In it's unmounted state you can change the ownership of /volumeUSB1/usbshare so it's easier to restrict access.

The ownership and permissions of /volumeUSB1/usbshare/Emby and Videos look right, assuming that is the HDD.

Link to comment
Share on other sites

eph77341
root@Diskstation:~# cd /volumeUSB1/usbshare
root@Diskstation:/volumeUSB1/usbshare# ls -l
total 1536
drwxrwxrwx 4 admin users 524288 Feb 10 17:32 @eaDir
drwxrwxrwx 3 admin users 524288 Jan 11 23:39 Emby
drwxrwxrwx 2 admin users 524288 Jul  9  2020 @tmp
root@Diskstation:/volumeUSB1/usbshare# cd Emby
root@Diskstation:/volumeUSB1/usbshare/Emby# ls -l
total 512
drwxrwxrwx 276 admin users 524288 Jan 23 20:16 Videos

I have revoked the authorization for the user "Emby" from usbshare in the Synology web interface. However, I cannot assign a new authorization for the "Emby"-folder in it. If I understand correctly, do I need the chmod command for this doing it via SSH? Do you know the exact syntax?

Commands with connected HDD. 

Edited by eph77341
Link to comment
Share on other sites

Q-Droid

It not clear to me where the sys vol ends and the HDD begins. Please show the mount points per my previous post. You could be making changes in the wrong level of the path.

If the web UI limits options and forces owner and permissions recursively then it might be best to make changes from the command line.

 

 

 

Link to comment
Share on other sites

eph77341

Sorry, i missed this part. I think the mount point is /dev/sdq1 when HDD is connected. But /volumeUSB1/usbshare still exists for Emby when HDD is disconnected.

root@Diskstation:~# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/md0                2.3G  1.4G  858M  62% /
devtmpfs                7.9G     0  7.9G   0% /dev
tmpfs                   7.9G  244K  7.9G   1% /dev/shm
tmpfs                   7.9G   24M  7.9G   1% /run
tmpfs                   7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs                   7.9G  988K  7.9G   1% /tmp
tmpfs                   1.6G     0  1.6G   0% /run/user/196791
/dev/mapper/cachedev_0   21T   16T  5.7T  73% /volume1
/dev/sdq1               1.9T  1.9T     0 100% /volumeUSB1/usbshare

 

Link to comment
Share on other sites

Q-Droid

Much better now. By the way it looks like your external HDD is full.

What you could try is unmount the HDD and change ownership and permissions of /volumeUSB1/usbshare:

- chown nobody:nobody /volumeUSB1/usbshare

- chmod 755 /volumeUSB1/usbshare

The important thing is for Emby/Videos to not exist when the HDD is not mounted.

Then mount the HDD. Now /volumeUSB1/usbshare/Emby and below should be owned by user emby with the permissions it had before:

Quote

 

root@Diskstation:/volumeUSB1/usbshare# ls -l
total 4
drwxr-xr-x 3 emby emby 4096 Feb  5 07:40 Emby

root@Diskstation:/volumeUSB1/usbshare/Emby# ls -l
total 4
drwxr-xr-x 2 emby emby 4096 Feb  5 07:43 Videos

 

It doesn't really matter what the ownership and permissions are for /volumeUSB1/usbshare when the drive is mounted as long as emby can see the path to the media.

I don't know if Synology will allow or have problems doing this outside of the UI so it might be worth trying to make these changes there first. If you can't then command line is the next option.

 

Link to comment
Share on other sites

eph77341

I disconnected my HDD but /Volume1/usbshare is no longer available. Meanwhile i deleted my Download-job within Emby. Does it make sense that this job keeps the folder in root directive alive?

Link to comment
Share on other sites

eph77341

Yeah, I'm quite sure when Emby does not have this download job, and i disconnected my hdd the path does not exist anymore in the root directory. 

Link to comment
Share on other sites

Q-Droid

Some relevant info is missing or something specific to Synology is going on. If USB drives are auto-mounted and the path created dynamically then the emby user should not have been able to create or modify a directory in root. I don't see how emby can create that path when the drive is not mounted unless it has permissions that it shouldn't. If the drive is mounted then removed while emby is trying to access for download that should have resulted in I/O errors.

So as I see it if /volumeUSB1 or /volumeUSB1/usbshare do not exist when the HDD is not attached then emby should not be able to create it and write files further into that directory. If it can then / (root) or the emby user have permissions settings that neither should have.

 

 

Link to comment
Share on other sites

eph77341

I have now recreated and executed the download job. I then removed the hard disk after the entire content had been synchronized. When I now try to start the job manually, nothing happens because Emby recognizes that all files are already on the HDD. The previous errors happened because not all media could be written to the disk. 

However, I can see that the folder /volumeUSB1/usbshare exists in the root directory even if the HDD was ejected. 

Within Synology I have revoked the rights for the usbshare from the user emby (system-internal, because Synology V7.2), but the data could still be copied to the HDD.

The permissions also look to me as if emby now has no access to the folder in the root as long as no HDD is connected. However, the permissions change when the HDD is connected.

HDD not connected:

root@Diskstation:~# ls -l
total 0
-rw-r--r-- 1 root root 0 Apr 19  2023 'FOR SYSTEM USE ONLY. DO NOT UPLOAD FILES HERE.'
root@Diskstation:~# cd /volumeUSB1
root@Diskstation:/volumeUSB1# ls -l
total 4
drwxrwxrwx 2 root root 4096 Feb 11 07:14 usbshare
root@Diskstation:/volumeUSB1# cd usbshare
root@Diskstation:/volumeUSB1/usbshare# ls -l
total 0

HDD connected:

root@Diskstation:~# cd /volumeUSB1
root@Diskstation:/volumeUSB1# ls -l
total 512
drwxrwxrwx 5 admin users 524288 Feb 15 18:29 usbshare
root@Diskstation:/volumeUSB1# cd usbshare
root@Diskstation:/volumeUSB1/usbshare# ls -l
total 1536
drwxrwxrwx 5 admin users 524288 Feb 15 18:29 @eaDir
drwxrwxrwx 3 admin users 524288 Feb 11 07:26 Emby
drwxrwxrwx 2 admin users 524288 Jul  9  2020 @tmp
root@Diskstation:/volumeUSB1/usbshare# cd Emby
root@Diskstation:/volumeUSB1/usbshare/Emby# ls -l
total 512
drwxrwxrwx 268 admin users 524288 Feb 13 00:40 Videos

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...