Every month I receive questions about how to perform various automation tasks via email. This blog series looks at the most common ones, and today’s post will focus on disk defragmentation.
This feels like an antiquated concept, as less and less people defrag. It’s pretty well known in the industry that mechanical disks benefit from periodic defragmentation; however, they can cause harm to SSDs. I don’t mean harm as in full-out crash and destroy it, but to somewhat lower its longevity, as most SSDs have tools built-in that will make it do its own housekeeping, move files around, etc. This is partly why we see SSDs slow down when the drive is nearly full, as there is not enough space for files to move around or for the housekeeping to be done. Since it’s automatic, we don’t need to defrag, but I’d still recommend periodic scandisks to ensure its healthy.
Coming back to non-defragmentation, let’s discuss the benefits of mechanical hard disks and hybrid (HDDs and SSHDs).
Because there is usually just one drive on desktops/laptops, it’s quite simple to detect if the drive is mechanical or solid state—and then do a defrag only if it’s a mechanical drive.
This automation policy (which is in the Automation Cookbook https://success.n-able.com/kb/nable_n-central/Defrag-C-if-the-Main-Drive-is-not-a-SSD ) detects the primary drive type, and if it’s not an SSD, it will trigger the defrag task.
To get to the Cookbook, go to n-able/cookbook. Don’t forget to click the Upload a Script button and submit your own automation. I get lots of people telling me, ‘’I totally want to share automation,’’ but rarely get anything new 12. Even if you think it’s not good enough, it’s always nice to collaborate with partners and take what you created, update it, if needed, and then share it back with the community. Don’t hesitate to click that shiny button if you want to send me something!