External HDD problems

For topics which do not fit in other specific forums.
sk8er000
Posts: 37
Joined: Fri Oct 01, 2021 2:31 pm
Has thanked: 12 times
Been thanked: 1 time

External HDD problems

Unread post by sk8er000 »

Hello,
I'm using this 2TB hdd for quite a while to store the games for mister : (https://www.westerndigital.com/products ... 20BBK-WESN). This HDD made some strange metallic sounds from the beginning but only when used with mister (tried 2 hdds of the same model) but didn't give me any particular problem when used for non CD games.
The real problem is if I try some CD games (like for PCECD). Sometimes I'm able to play for a while but sometimes in less than 5 minutes the game begins to lose the audio track and after few more seconds it freezes.
I've tried formatting the HDD FAT32 and ExFAT but both satandars have the same behaviour. I'm using a 5V 4A 20W PSU and the the 2.1 USB hub (with internal connetion to the de10: https://ultimatemister.com/product/usb- ... idgeboard/)

Anyone has some suggestion? Do I have to use an ssd to have a more reliable use?
Thank you in advance
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: External HDD problems

Unread post by jca »

I have been using a USB HDD for years without any problem. The only thing to be aware of is that HDD usually go to "sleep" after a certain amount of time by spinning down.
I wrote 2 scripts to keep my HDD spinning:
viewtopic.php?p=14964#p14964
I could solve your problem.
sk8er000
Posts: 37
Joined: Fri Oct 01, 2021 2:31 pm
Has thanked: 12 times
Been thanked: 1 time

Re: External HDD problems

Unread post by sk8er000 »

Thank you for your answer, I've tried following your suggestion but after a while the error occurred again, I'll try to lower the interval. The only odd thin is that I have a very short UUID on both the HDDs I've tried (I connected only once a time with same files when I tried to play):

Code: Select all

/root# blkid
/dev/loop0: UUID="1ee65149-762a-43be-9c95-9313b03a7550" BLOCK_SIZE="1024" TYPE="ext4"
/dev/mmcblk0p1: LABEL="MiSTer_Data" UUID="5AFA-4559" BLOCK_SIZE="512" TYPE="exfat" PARTUUID="ad7f6ce9-01"
/dev/mmcblk0p2: PARTUUID="ad7f6ce9-02"
/dev/loop8: LABEL="rootfs" UUID="aa2c2e42-06c9-49cb-badb-347f31649b66" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda1: LABEL="MiSTer-HDD" UUID="6272-A2C4" BLOCK_SIZE="512" TYPE="exfat" PARTLABEL="Elements" PARTUUID="0b7e6d76-e61d-445a-b477-19fdd876cfc3"
/dev/sdb1: LABEL="MiSTer HDD" UUID="1B1A-3C04" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="El" PARTUUID="1b44fe7f-1d6c-4a1b-8455-9133f80b1369"
According to this for the moment I've this 2 sript (Spin and S99spin) on /etc/init.d and on /media/fat/Scripts (in both places with no extension:

Spin:

Code: Select all

#!/bin/bash
while :
do
dd if=/dev/disk/by-uuid/06272-A2C4 of=/dev/null count=1 skip=$RANDOM >/dev/null 2>&1
sleep 3m
done
S99spin:

Code: Select all

#!/bin/bash
nohup /media/fat/Scripts/Spin </dev/null >/dev/null 2>/dev/null &
Am I missing something?
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: External HDD problems

Unread post by jca »

For the UUIDs I do not know how these things are created but if blkid says it is xyz that is what you have to use.
The file system in use is of no importance, I tried exFat, NTFS and ext4 without any problem
You can make sure that the scripts are executable.
To make sure that the Spin script is running you can use the console of SSH and type
ps -ef | grep "Spin"
You should get 2 lines: one relative to the grep command itself and the other the Spin script.
For the length of the timeout you can do 2 things depending on your HDD:
I have a WD Elements disk (it looks like you also have one). For this one you can see when it times out by looking at the drive LED which starts to blink when going to sleep. For my WD Elements it takes 15 min.
I also have a regular 3.5" HDD and for that one I just put my hand on it and feels when it stops.
I do not know if it will fix your problem as you said in the end the game freezes. Normally it should just pause while the disk is spinning up and resume after that, on my WD Elements it takes something like 15s.
But I remember that I also ran into the problem where MISTer is frozen and I had to reboot. It only happened a few times and I don't remember what I was doing at the time.
In any case it is worth trying as it is the only thing I can think of and I don't remember anyone having the kind of problem you have which will make it difficult to figure out if it is not the spin problem.
fierman
Posts: 111
Joined: Mon Mar 28, 2022 11:08 pm
Has thanked: 83 times
Been thanked: 23 times

Re: External HDD problems

Unread post by fierman »

Try with a powered usb hub, and see if that helps. Drives with platters do peak in power consumption, and perhaps the usb port of your MiSTer setup does not deliver enough.
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: External HDD problems

Unread post by jca »

There is another thread on the forum related to the same topic. It looks like the problem comes from the official USB HUB:
viewtopic.php?t=4652
I am using a generic, decades old, powered USB HUB using an OTG cable and never had any problem.
sk8er000
Posts: 37
Joined: Fri Oct 01, 2021 2:31 pm
Has thanked: 12 times
Been thanked: 1 time

Re: External HDD problems

Unread post by sk8er000 »

I might have found at least one of the issues the S99spin script in /etc/init.d doesn't star when mister is booting, if I manually start the spin script at least is reported to run when I check with ps -ef | grep "Spin" command. I did'nt test enough the misteer with the script running but it's been like 30 minutes that I'm running some PCECD games (and leave the attract mode for a while) and everything seems fine for the moment).

Do you have any hint on why the script is not automatically starting?

Thank you in advance
sk8er000
Posts: 37
Joined: Fri Oct 01, 2021 2:31 pm
Has thanked: 12 times
Been thanked: 1 time

Re: External HDD problems

Unread post by sk8er000 »

Little update.
At the moment I've solved the automatic run of the script on boot by adding:

Code: Select all

sh /media/fat/Scripts/S99spin
After creating a new user-startup.sh file on /media/fat/linux.

Now I need to test if using the script I'll have the same issue but at least it seems to run properli on boot now
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: External HDD problems

Unread post by jca »

My guess is that you did not make the S99spin script executable.
When I wrote these scripts the user-startup script did not exist, after it was introduced I had a quick look at it but I was not sure how to use this feature and I did not try very hard as the way I had things setup worked properly.
Post Reply