Heavy loads or high temperatures shorten the life of your PC’s storage medium. But you don’t have to. In this article we look at how you can keep your drive healthy under Linux.
![tux hdd](https://webwereld.nl/cmsdata/features/3781213/tux_hdd_thumb800.jpg)
The storage memory of your PC, in the form of a hard disk or SSD, must be reliable. Because problems can arise at any time, it is wise to use a backup system to always have a current copy of your data. You can limit the risk of unexpected outages with a few measures that we discuss with you in this article. But we start from the beginning:
Choose the correct drive
If you are mainly looking for speed in a hard disk, then a disk with a high rotational speed is obvious, for example 7200 rpm. The disadvantage of this is that it provides more heat and is more susceptible to wear than one with a lower speed. Smaller disks in laptops, 2.5 inch, usually run slower at 5400 rpm and therefore also generate less heat.
Manufacturers specify ambient temperatures between 5 and 55 degrees for proper operation. At room temperature, the temperature of the HDD can rise to around 40 degrees. Slower disks, 5200 or 5700, are usually a good ten degrees cooler. Research by Seagate showed that a temperature of 25 degrees instead of 42 degrees doubles the life of a hard disk.
Cooling is therefore very important. With internal disks, this is often not a problem, because of the cooling of the housing and other places that cause air flow. This is less the case with external disks in a USB case or dock, where the disk can quickly become too hot. Therefore, lower speeds are recommended for external drives.
Operation of the sleep mode
Hard disks can be put into sleep mode with the help of software, which limits the heat output. In Ubuntu you use the Disks tool (gnome disks) to set when the device should be turned off. Select in Disks your station on the left and then choose the Station Settings below the menu button (three horizontal lines). Set the slider under the standby settings below On and choose a length of time before the system goes into sleep mode, ranging from never to 5.5 hours.
The menu button is for external hard drives Station Settings in the utility gray. But most external USB drives can also be configured in such a way that you can use standby mode. You do that with the tool hdparm. To do this, open a terminal and tap blkid to generate a list of disks, volume names, and UUID identifiers.
For example, if the disk you have in mind is / dev / sdb, use the following command to activate sleep mode: sudo hdparm -y / dev / sdb, the last parameter thus indicating the path of the coupling point.
You can use a command to set up automatic shutdown in the same way. Take sudo hdparm -S 180 / dev / sdb. The value -S stands for 180 x 5 seconds, or fifteen minutes. Use -S 0 if you don’t want a drive ever to be turned off. You can find more information about the parameters by man hdparm to use.
The adjustment you make with this only applies until you restart the system. If you want to change this permanently, you must edit the hdparm configuration file with the command sudo gedit /etc/hdparm.conf. That opens the file in an editor and you adjust the following line there: / dev / disk / by-uuid / {spindown_time = 180}. Replace with the UUID that you found with blkid.
Limit SSD disk access
Because there are no moving parts in an SSD, less heat is generated. Even if an SSD is in continuous use, there is little wear in that regard. But the memory cells of flash memory are suitable for a certain number of erasure and write actions. For example, manufacturers give guarantees such as five years or 150 TBW (Terabytes Written) on an SSD. That amounts to 82 GB per day and an average PC user is currently around 20 GB per day. SSDs also have spare memory to compensate for the loss of any defective cells.
So it is not so bad with the wear and tear, but despite that you can limit the disk access to curb write actions. For example, you can move the paging file to the HDD. If your hard disk is mounted to something like / mnt / data, copy the file / swapfile to this folder under Ubuntu 18.04 / 19.04. Change in the file / etc / fstab the reference / swapfile, in this example to / mnt / data / swapfile and make sure that this line is below the line where the hard disk is mounted. For the directory / tmp you add the rule / mnt / data / tmp / tmp none bind 0 0 to.
Here you can also add mount options for the SSD. A typical entry can look like UUID =[ID] / ext4 errors = remount-ro, noatime, nodiratime 0 1 wherein the noatime, nodiratime parameters prevent Linux from storing data about file access times in the file system, resulting in unnecessary write actions.