USB Copy fails with sleeping drives

Backup and restore solutions, issues, experiences
Locked
User avatar
iPeriod
Posts: 10
Joined: 19 Jul 2020, 08:56

USB Copy fails with sleeping drives

Post by iPeriod »

Hi,
I found out the hard way that USB Copy fails in several repects if a USB drive happens to be sleeping.
After being disappointed with the performance of the in-built RSync server, I tried to use USB Copy to make scheduled backups from the internal NAS to external storage.
All appeared to go well when I setup and tested the USB Copy jobs as one-off runs. The reason this went well was because the external storage drives were 'awake' and USB Copy worked as expected. The jobs were then scheduled to run before the daily NAS shutdown and should have had nothing to copy as I'd completed a manual backup the same day.

However, on checking the logs the following morning, all the jobs started but never finished.
Information Task backup_videos has started 2021-01-24 00:30:01
Information Task backup_timeshift has started 2021-01-24 00:10:00
Information Task backup_dev_library has started 2021-01-24 00:08:00
Information Task backup_music has started 2021-01-24 00:00:00

Looking at the USB Copy jobs in the UI, all were marked as "USB drive has been removed"
The destination external drive now showed up as unmounted. Running 'mount' confirmed this.

Gripe #1: there appears to be no way to manually mount an external drive via the UI.

Manually mounting the drive failed:

Code: Select all

mount -t ext4 /dev/sdh1 /mnt/usb/usbshare2
mount: wrong fs type, bad option, bad superblock on /dev/sdh1,
       missing codepage or helper program, or other error
I tried a system reboot, but this didn't resolve the missing external disk.
Running fdisk and lsblk confirmed the external drive was responding so it appeared to be a ext4 journal issue.

Gripe #2: Why doesn't the NAS perform a sync before shutdown and an optional disk check on startup? There is a UI to specify a scheduled restart, why not have an option to force an optional disk check in cases like this.

I did manage to recover the ext4 journal by manually running:

Code: Select all

fsck -y /dev/sdh1
As USB Copy stands, its not really fit for purpose until it can SEAMLESSLY handle sleeping disk both in the UI and while running tasks. As a result I am seriously looking to setup an other Rsync server and connecting the USB array to this new server.

For those of you using USB Copy, I'd suggest you run a script before any scheduled copy to wake up the drive(s) before the USB Copy occurs. This will save you a lot of grief.
I've not tested to see if the Rsync server can also handle sleeping external drives so I'd run the wakey wakey script just in case.

Can you confirm if any/all of these issues have been fixed in TOS 4.2.08?

i.

HW
TM F4-210, 2GB
RAID5: 4x X400 4TB
Ext USB 3.0: Icy Box IB-3664SU3, 3x N300 8TB
SW
TOS: 4.1.27-2006291655
USB Copy: 1.5.6
User avatar
TMRyan
TerraMaster Team
Posts: 817
Joined: 01 Dec 2020, 11:50

Re: USB Copy fails with sleeping drives

Post by TMRyan »

Hello,
The manual mount command is: mount.ntfs-3g /dev/sdh1 /mnt/usb/usbshare2
Can you show us the screenshot you see in the UI?
You can add files and try a second backup, and then see if the backup can be successful.
To contact our team, please send email to following addresses, remember to replace (at) with @
Technical team: support(at)terra-master.com (for technical support)
Service team: service(at)terra-master.com (for purchasing, return, replacement)
User avatar
sianderson
Posts: 293
Joined: 02 Aug 2020, 03:42
Great Britain

Re: USB Copy fails with sleeping drives

Post by sianderson »

iPeriod wrote: 27 Jan 2021, 02:16 Can you confirm if any/all of these issues have been fixed in TOS 4.2.08?
i am running 4.2.08 with a USB enclosure as a backup, the USB hard drive seems to go to sleep as when i try and access it i hear it spinning up and click in (however TOS sees it as being connected permanently so it doesn't need to mount it all the time)

i previously had it on a smart switch which seemed to work perfectly since august up until a few weeks ago (can only think its a recent version of TOS that's caused the issue) so that it powered up before the backup and then powered down after to protect the data most of the day, however backup jobs seem to get changed from sub folders to the root of the USB perhaps because it didn't recognise the USB on powerup (8 jobs then merged / overwrote data on the USB, effectively meaning i no longer actually had a backup of my data on the USB)

i am pleased to say though that by leaving the power onto the USB it is working as it should (i am now in the habit of checking the data on the USB most days) so unsure why you need to do any manual mounting as it should recognise when you plug it in and then still maintain its connection even though the drive has spun down?)

what kind of USB drive are you using? i wonder if its a feature of the one you have that's causing the issue, i use an enclosure with a 5TB WD drive in it
F2-210

4.2.43
User avatar
iPeriod
Posts: 10
Joined: 19 Jul 2020, 08:56

Re: USB Copy fails with sleeping drives

Post by iPeriod »

@Ryan
The manual mount command is: mount.ntfs-3g /dev/sdh1 /mnt/usb/usbshare2
The OEM USB drives were formatted as EXT4 on my client machine (I didn't know if the NAS's format would allow tuning of the partition parameters) before being connected to the NAS.
So the mount command I used is correct for mounting EXT4 partitions. Your example is for mounting a NTFS partition which I'm not using.

Can you show us the screenshot you see in the UI?
I'm not sure what screenshots you want but hopefully the attached ones will do.
CP_Ext_storage.png
CP_Ext_storage.png (5.17 KiB) Viewed 3263 times
USB_Copy_Tasks_list.png
USB_Copy_Tasks_list.png (5.19 KiB) Viewed 3263 times
You can add files and try a second backup, and then see if the backup can be successful.
I did mention I manually tested the USB Copy tasks successfully before enabling the scheduling. The scheduled tasks should all have been empty as no further changes to the NAS volumes were made prior to the scheduled backups.
I am not prepared to retry this again as it took me a day to copy the files over to USB HDD and a few hours to recover the mess left behind.
If you examine the USB Copy log files more closely you will see the four tasks failed within a 30 minute period. I now know the USB drives take approx 15-20 seconds to wake up so I'd expect the first task to fail and the following three tasks scheduled to run later to succeed -- IF the drive was successfully woken up by the first task. Unfortunately it wasn't.
What appears to have happened was the USB target drive failed to cleanly unmount when the NAS was scheduled to shutdown approx 2hrs later. This would explain the corrupted EXT4 journal. The other 2 USB drives were not backup targets and were correctly reported as mounted in the UI ofter the NAS restarted the following day.

I should also add the NAS's Hard Drive Sleep is set to 30mins. The USB drives do indeed fall asleep after 30mins.

@sianderson
I have 3 drives (Toshiba N300's) installed in an Icy Box IB-4664SU3 enclosure. The enclosure is connected to the NAS via USB3.0. The drives are recognised successfully when the NAS starts up and will wake from sleep when accessed via some parts of the TOS UI. The latter rules out a purely hardware issue related to HDD sleep mode.
I tried to manually mount the copy drive after the scheduled copy failed. Once I'd recovered the EXT4 journal and cleaned up the mess with remnant mount points and symlinks, the drive successfully mounted when I restarted the NAS. The USB array is powered 24/7, its just the NAS that's configure for a scheduled shutdown and restart.

i.
User avatar
iPeriod
Posts: 10
Joined: 19 Jul 2020, 08:56

Re: USB Copy fails with sleeping drives

Post by iPeriod »

Sorry, it looks like my attempt to include a couple of snapshots has failed.
i.
User avatar
TMroy
TerraMaster Team
Posts: 2578
Joined: 10 Mar 2020, 14:04
China

Re: USB Copy fails with sleeping drives

Post by TMroy »

USB array or USB dock is not recommended to connect to your TNAS except of TerraMaster USB DAS array. That need special driver support or it may run into issues. please try with another USB device only single drive.
To contact our team, please send email to following addresses, remember to replace (at) with @:
Support team: support(at)terra-master.com (for technical support only)
Service team: service(at)terra-master.com (for purchasing, return, replacement, RMA service)
Locked