SSD

How to keep a USB disk awake in XPenology [Octubre 2022]

 

A few weeks ago we showed you how to set up an XPenology project with a cheap PC and USB external drives. Some USB drives, especially those that have intelligent management type JBOD or various RAID modes, can give us problems due to disconnections or suspended inputs that generate problems in data management. The fall of a USB drive can, among other effects, stop services associated with this data such as non-compliance with ratios, download activity or remote multimedia playback.

To achieve stability on USB drives mounted on a XPenology we must set a fixed name for the unit. The system enumerates the USB drives as: usbshare1, usbshare2, etc. If we set a name we will have won part of the battle. We can do that in the FileStation. There we will change the unit “usbshare” by whatever name we want. The change is persistent, even if we reboot.

If our USB drive insists on turning off, going to sleep, every so often then the most direct and simple method is to create a Linux “script” that we run every five minutes (the shortest period that the DSM task scheduler supports), where we force the hard drive to have activity. So that the activity is definitely noticeable to the system the best thing is to generate some type of writing on the disk.

The writing should not be very intense so as not to reduce the life of the drive foolishly. We can create a script that writes a file to our USB drive every 5 minutes. That will be enough. We can generate the script directly from the Web interface with the DSM text editor.

We can, for example, make the system write a 1MB file, always the same, on the USB drive that we want to keep awake. This will be done every 5 minutes, 288 times a day, 2880MB written to the hard drive every day. It is a script that we can do in many ways and that I summarize in this: dd if=/dev/zero of=/volumeUSB2/usbshare/Descarga/output.dat bs=1MĀ  count=10

The script is easy to understand, but for the most layman what this script does is fill a file called output.dat with zeros. Zeros are counted by 10 times, 1MB. 10MB of writing in total. The file is overwritten every time the command is run. There is no accumulation. You can reduce it to expand it by modifying the loop counter in “count” or the size in “bs =”.

You will have to change the path of your unit to match the correct one. In my line you can have clues on how to locate the unit through FileStation, using the context menu of “properties” we can find out the exact path of the file system where exactly you want to put the file. We will record the script in one of the folders on our NAS with the extension “.sh”.

Now we just have to schedule a task. The DSM has a simple but suitable task scheduler for this type of work. We will find the task scheduler in the control Panel. We will create a new task, of type “user defined script”. In the first creation tab we will define the name and where the script is. We will have to give it the path where we save the “.sh” file. We can find the path using the “properties” of the file from the FileStation. Defined the name and enabled the task, we pass the program tab.

In the program we will tell you to run it “every day.” We will define the start time as 00:00 hours, the last execution time as 23:55 hours and running every 5 minutes. This will run continuously, every day, every five minutes. We give ok when we finish.

From now on our USB drive will never go to sleep and we will have a much more stable system.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
%d bloggers like this: