De-frag hard drive?

70 Tango Charlie

Well-Known Member
Credits
986
Greetings everyone,
Seeing that I was a Windows guy for lots of years, de-fragging the hard-drive every so often was recommended.
Since coming to Linux, I have not seen anything at all about de-fragging.
Am I coming to the right conclusion that there is no need to de-frag; and is this because of the way the file system is set up?
Thanks from the old geezer
TC
 


Condobloke

Well-Known Member
Credits
4,989
Running Linux Mint 18.3 for 5 years ....spaced across 3 hard drives....haven't defragged one of them in that time, and have no need to do so.
 

70 Tango Charlie

Well-Known Member
Credits
986
Thanks for the responses guys. That confirms my guesses.
I get a kick out of trying to figure stuff out. Looking back on my life, that seems to be the way I have always been. It's the way I have learned how to operate the cp. {start pushing buttons and see what happens} The biggest problem with that is remembering which buttons I pushed to get the result I got! LOL.
Old Geezer
TC
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
7,314

Condobloke

Well-Known Member
Credits
4,989
Somewhat likewise here.....(remembering what I typed to achieve a particular result).....

I had to go back to a topic dated May, 2018 to remind myself how to "trim" a SSD !!!!

Haven't done it for a while...it took care of 3.8 GB !!

(This only applies to Solid State Drives)
 

samK

New Member
Credits
200
When your hard disk reads the file, its heads must skip around between different physical locations on the hard drive to read each chunk of sectors — this slows things down. Defragmenting is an intensive process that moves the bits of files around to reduce fragmentation, ensuring each file is contiguous on the drive
 

captain-sensible

Well-Known Member
Credits
7,388
Thanks for the responses guys. That confirms my guesses.
I get a kick out of trying to figure stuff out. Looking back on my life, that seems to be the way I have always been. It's the way I have learned how to operate the cp. {start pushing buttons and see what happens} The biggest problem with that is remembering which buttons I pushed to get the result I got! LOL.
Old Geezer
TC
me 2 ; i write everything down
 

TNFrank

New Member
Credits
121
The way the GNU/Linux File System works you don't really need to de-frag your hard drive. In face if you're running an SSD you should NEVER de-frag since it puts unnecessary ware and tear on the drive.
 

jglen490

Well-Known Member
Credits
3,076
If you feel like you must do something, do an fsck on the partition(s). If it finds errors, it will attempt to fix. Otherwise, it will just say that everything is "clean".

And it will be!
 

sam444

Member
Credits
318
As others have said, you don't need to defrag with Linux because Linux isn't Windoze and thank God for that.
 

jglen490

Well-Known Member
Credits
3,076
Actually, I'm pretty sure most modern Linux distros install a TRIM run out of the box, and typically configurable if you don't like the default run period. This is what mine looks like under Kubuntu 20.04.1:
Code:
[email protected]:/etc$ systemctl status fstrim.timer
● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Sun 2020-11-01 06:54:43 CST; 12h ago
    Trigger: Mon 2020-11-02 00:00:00 CST; 4h 37min left
   Triggers: ● fstrim.service
       Docs: man:fstrim

Nov 01 06:54:43 john-Desktop systemd[1]: Started Discard unused blocks once a week.
And this is how it's set up:
Code:
[email protected]:/etc$ systemctl cat fstrim.service
# /lib/systemd/system/fstrim.service
[Unit]
Description=Discard unused blocks on filesystems from /etc/fstab
Documentation=man:fstrim(8)
ConditionVirtualization=!container

[Service]
Type=oneshot
ExecStart=/sbin/fstrim --fstab --verbose --quiet
ProtectSystem=strict
ProtectHome=yes
PrivateDevices=no
PrivateNetwork=yes
PrivateUsers=no
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
MemoryDenyWriteExecute=yes
[email protected] @file-system @basic-io @system-service
 

jglen490

Well-Known Member
Credits
3,076
Umm, yes, like I said ;)
 

sam444

Member
Credits
318
I have Trim set to daily on my SSD but I will from time to time do it manually with this...
Code:
 sudo fstrim -av
Manually it looks like this when done...
/: 245 GiB (263098654720 bytes) trimmed

:)
 


Members online


Latest posts

Top