I am running some simulations in Matlab on a Linux machine (running Debian Gnome v3.4.2).

All the scripts and heavy .mat files are in an external 1TB Toshiba hard-drive connected through USB 3.0 to the Linux machine.

I am running some heavy simulations from the hard-drive, which last for hours (potentially even days), and involve some reading/writing of those files into the hard-drive. Matlab itself is installed on the Linux machine.

The problem is, after some time it seems like the hard-drive is unmounted or goes to sleep, as the Matlab simulation stops and says that a given function is missing (which it clearly isn't, since it was used in previous performed steps of the simulation).


  • This Linux machine belongs to my university, and I haven't sudo rights, only user.

  • I have read this thread, and the Linux-specific answer didn't work, since I get sdparm: Command not found.

1 Answer 1


I had the same problem while doing a backup with rsync, because it needs many minutes to compile the backup list and the USB harddisk disappears sometimes. The C program in the other thread looks overly complicated. I use this script, which writes a file with the current date every minute to the disk, and then synchronizes the file systems, which causes to physically write all write caches that might be there to the disks:


while true; do
    date | tee /media/frank/backup/ping.txt
    sleep 60

Replace the path to your USB disk, save it as ping.sh and then start it in another terminal. The "tee" command shows the current date in the terminal as well, to see that it is still running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .