De-frag hard drive?

70 Tango Charlie

Well-Known Member
Joined
Oct 7, 2019
Messages
523
Reaction score
676
Credits
2,064
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
Joined
Apr 30, 2017
Messages
5,877
Reaction score
4,888
Credits
36,718
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.
 
OP
70 Tango Charlie

70 Tango Charlie

Well-Known Member
Joined
Oct 7, 2019
Messages
523
Reaction score
676
Credits
2,064
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

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,362
Reaction score
7,263
Credits
33,215

Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,877
Reaction score
4,888
Credits
36,718
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
Joined
Jun 17, 2020
Messages
27
Reaction score
3
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
Joined
Jun 14, 2019
Messages
2,910
Reaction score
1,970
Credits
18,114
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
Joined
Oct 14, 2020
Messages
19
Reaction score
13
Credits
154
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
Joined
Mar 10, 2020
Messages
736
Reaction score
505
Credits
4,106
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!
 

bec2

New Member
Joined
Oct 8, 2020
Messages
13
Reaction score
18
Credits
93
No need to defrag, usually.
We are a spoiled bunch, aren't we?
 

bob466

Well-Known Member
Joined
Oct 22, 2020
Messages
843
Reaction score
609
Credits
6,292
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
Joined
Mar 10, 2020
Messages
736
Reaction score
505
Credits
4,106
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
 

TNFrank

New Member
Joined
Oct 14, 2020
Messages
19
Reaction score
13
Credits
154
I do think they use trim also. I just like to do it manually from time to time to make sure.
 

jglen490

Well-Known Member
Joined
Mar 10, 2020
Messages
736
Reaction score
505
Credits
4,106
Umm, yes, like I said ;)
 

bob466

Well-Known Member
Joined
Oct 22, 2020
Messages
843
Reaction score
609
Credits
6,292
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

:)
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Top