[SOLVED] Best way to defragment hard drives in Linux?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hey I have a bunch of drives and I have a feeling several of them are very fragmented. You know, part of a large .mp4 is stored here and part is stored there, and when navigating through one folder, the files in that folder are spread out all through the drive. How do I correct this? Is there any open source software out there that can help me?
I suppose it would depend on the file system in use (there are many) but I am pretty sure this is not necessary. Others may chime in and correct me. Keep in mind that Microsoft (IMHO) has developed terrible file systems and users have grown used to dealing with their idiosyncrasies. I have been using various Linux and BSD file systems for over 2 decades and have not defragged a drive in that entire time. I do "TRIM" on SSDs but my file system takes care of that for me and I don't have to do it manually. Not sure how this relates to fragmentation.
Again, someone that knows way more about this will I am sure add to this...
Hey I have a bunch of drives and I have a feeling several of them are very fragmented. You know, part of a large .mp4 is stored here and part is stored there, and when navigating through one folder, the files in that folder are spread out all through the drive.
What gives you this feeling?
Also, if this is an SSD, then keep in mind that this would have no impact on performance even if it were true.
Okay so the drive I'm talking about is a mechanical 6TB drive and its housed in a external case (if that's at all relevant). I connect it to my pc by way of a USB 3.1 cable and then read documents off it or watch movies. It makes odd sounds sometimes when reading a movie like there's some sort of hesitation on the part of the drive.
Another question I have is:
Will watching movies and reading documents off the drive directly limits its overall life? So what I mean is reading the content on the drive as opposed to writing it.
Mechanical drives under Linux filesystems do not suffer from fragmentation. That's what the link shruggy posted states, in essence.
Using a drive at all shortens its life but what good is a drive if you don't use it...make backups if there is any doubt of the drive's reliability.
Some drives make a little noise when reading and writing some are silent. My NAS drives make noise from time to time and it's normal. I have backups so if a drive fails, I can replace it and restore the data.
EDIT: what file system is the drive using? Is it NTFS or a Linux file system?
Last edited by sevendogsbsd; 04-30-2020 at 02:59 PM.
Thank you! I'm reading the document the other guy posted right now in order to gain more of a technical understanding of why it doesn't require defraging.
Thanks again for the help. How do I give rep points?
Copy files off and copy them back to newly formatted much like the old ntbackup.
/
It makes sense to me somehow why that would work and be a form of consolodation of files of the same directory in one place, but I don't know why.
So let's say I finished adding all the movies I wanted to a certain movie database and I was done adding files to that directory. At that point I would want to copy that movie database to drive B, reformat drive A back into ext4 and then copy the directory back to Drive A from drive B?
Yes it is... but don't be surprised if you don't see much improvement. While you can defragment drives in Linux, it is generally not necessary. They defragment themselves with use.
Modern NTFS no longer requires defragmenting either, unless you want to shrink a partition.
Accessing a large, mechanical, encrypted drive over USB is always going to be slower than if it were SATA.
Accessing a large, mechanical, encrypted drive over USB is always going to be slower than if it were SATA.
I totally agree but I can't find an eSATA to USB cord for less than $50 and I want this particular drive to be an external drive. Know any cheaper sources for a eSATA to USB cord?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.