Defrag

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Chriske
Level 3
Level 3
Posts: 126
Joined: Wed Jun 06, 2018 3:21 am

Defrag

Post by Chriske » Fri Jun 15, 2018 4:34 am

Hi,

Is there a similar software tool for Linux.

Thanks
Chris

User avatar
Moem
Level 16
Level 16
Posts: 6520
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: Defrag

Post by Moem » Fri Jun 15, 2018 4:41 am

There is no such tool provided with Mint. That's because it isn't needed. This topic should help: viewtopic.php?f=90&t=31723
Also see this article: https://www.howtogeek.com/115229/htg-ex ... agmenting/
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!

User avatar
catweazel
Level 17
Level 17
Posts: 7044
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Defrag

Post by catweazel » Fri Jun 15, 2018 4:41 am

Chriske wrote:
Fri Jun 15, 2018 4:34 am
Is there a similar software tool for Linux.
https://www.howtoforge.com/tutorial/lin ... em-defrag/
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
catweazel
Level 17
Level 17
Posts: 7044
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Defrag

Post by catweazel » Fri Jun 15, 2018 4:42 am

Moem wrote:
Fri Jun 15, 2018 4:41 am
No. There isn't one and it isn't needed. This topic should help: viewtopic.php?f=90&t=31723
From the link above...
There is a common misconception among GNU/Linux users that our systems never ever need to be defragmented.

Code: Select all

~ $: e4defrag
Usage   : e4defrag [-v] file...| directory...| device...
        : e4defrag  -c  file...| directory...| device...
A defrag tool is already installed.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
Pjotr
Level 20
Level 20
Posts: 10775
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Defrag

Post by Pjotr » Fri Jun 15, 2018 4:45 am

There are some defrag tools in the fringes of the Linux ecosystem, but *do not* use them. Ever. Don't even think about it. The risk of massive data loss is huge. :shock:

The only thing you need to do in Linux, is *prevent* fragmentation. Which you can easily achieve, by keeping at least 20 % of your Linux partition unused, at all times.

Explanation:
https://sites.google.com/site/easylinux ... -in-Linux-
(item 4, left column)
Last edited by Pjotr on Fri Jun 15, 2018 4:46 am, edited 2 times in total.
Tip: 10 things to do after installing Linux Mint 19 Tara
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.

User avatar
Moem
Level 16
Level 16
Posts: 6520
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: Defrag

Post by Moem » Fri Jun 15, 2018 4:46 am

Well well, seems that I'm behind the times and there is indeed a tool provided. Not that I feel the need to use it...
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!

User avatar
Moem
Level 16
Level 16
Posts: 6520
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: Defrag

Post by Moem » Fri Jun 15, 2018 4:47 am

From the link above:
Since many users nowadays use SSDs and not HDDs, it is important to note that the defragmentation procedure is only beneficial for the later. If you own an SSD, there is simply no point in worrying about fragmented files as those disks can access their storage randomly, wheres HDDs access sequentially. Defragging your SSD will only increase the read/write count and thus reduce the lifetime of your disk.
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!

User avatar
catweazel
Level 17
Level 17
Posts: 7044
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Defrag

Post by catweazel » Fri Jun 15, 2018 4:48 am

Pjotr wrote:
Fri Jun 15, 2018 4:45 am
There are some defrag tools in the fringes of the Linux ecosystem
Linux Mint is on the fringes?
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
catweazel
Level 17
Level 17
Posts: 7044
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Defrag

Post by catweazel » Fri Jun 15, 2018 4:49 am

Moem wrote:
Fri Jun 15, 2018 4:47 am
From the link above:
Since many users nowadays use SSDs and not HDDs, it is important to note that the defragmentation procedure is only beneficial for the later. If you own an SSD, there is simply no point in worrying about fragmented files as those disks can access their storage randomly, wheres HDDs access sequentially. Defragging your SSD will only increase the read/write count and thus reduce the lifetime of your disk.
Yes. I was going to edit the post and remind the OP not to use it on an SSD but you'd already responded by the time I realised.

Cheers.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
Pjotr
Level 20
Level 20
Posts: 10775
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Defrag

Post by Pjotr » Fri Jun 15, 2018 4:57 am

It's a common fallacy that fragmentation doesn't hurt on an SSD. On the contrary: it's definitely also worthwhile to prevent fragmentation on an SSD:
https://sites.google.com/site/easylinux ... NOT-defrag
(item 16, right column)

Key quote for the lazy:
Zero mechanical seek time certainly does not mean zero I/O time. No matter how fast an SSD is, its I/O time can never be zero. File system fragmentation increases I/O time in an SSD, even when the mechanical seek time is zero.
Prevent fragmentation, don't defrag. If your data mean anything at all to you.
Tip: 10 things to do after installing Linux Mint 19 Tara
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.

User avatar
catweazel
Level 17
Level 17
Posts: 7044
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Defrag

Post by catweazel » Fri Jun 15, 2018 5:15 am

Pjotr wrote:
Fri Jun 15, 2018 4:57 am
Key quote for the lazy:
The unanswered question stands. Linux Mint is on the fringes?
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
Pjotr
Level 20
Level 20
Posts: 10775
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Defrag

Post by Pjotr » Fri Jun 15, 2018 5:38 am

catweazel wrote:
Fri Jun 15, 2018 5:15 am
The unanswered question stands. Linux Mint is on the fringes?
Where did I make such a claim? :shock:

Linux Mint = Linux, but Linux ≠ Linux Mint.

The Linux ecosystem is vast and huge. Amongst all the useful stuff in it, there's also some dangerous garbage that you'd better avoid.
Tip: 10 things to do after installing Linux Mint 19 Tara
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.

User avatar
catweazel
Level 17
Level 17
Posts: 7044
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Defrag

Post by catweazel » Fri Jun 15, 2018 5:42 am

Pjotr wrote:
Fri Jun 15, 2018 5:38 am
catweazel wrote:
Fri Jun 15, 2018 5:15 am
The unanswered question stands. Linux Mint is on the fringes?
Where did I make such a claim? :shock:
I didn't say you did.
Linux Mint = Linux, but Linux ≠ Linux Mint.

The Linux ecosystem is vast and huge. Amongst all the useful stuff in it, there's also some dangerous garbage that you'd better avoid.
The safest way to defrag a HDD is to back it up, format it and copy the files back. No need for dangerous tools, even if they are installed by default.
Caution: Dancing Wu Li Master and Official curmudgeon-in-chief

User avatar
thx-1138
Level 6
Level 6
Posts: 1088
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Defrag

Post by thx-1138 » Fri Jun 15, 2018 7:19 am

Code: Select all

Filesystem created:       Mon Oct 24 11:08:57 2016
Lifetime writes:          4831 GB
For the whole / ....

Code: Select all

File Fragmentation Rate:	0.102693186731731 %
And specifically for /home ....

Code: Select all

File Fragmentation Rate:	2.84839203675345 %
Ie., after 20 months of daily use, and after almost 5 Terabytes of writing, i guess i could probably select the 10 biggest files from home,
and copy them back & forth to an external disk...to gain myself a 2% improvement in read operations of my personal files... :lol:
ext4 knows it's job just fine :-)

User avatar
Pjotr
Level 20
Level 20
Posts: 10775
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Defrag

Post by Pjotr » Fri Jun 15, 2018 7:28 am

thx-1138 wrote:
Fri Jun 15, 2018 7:19 am
Ie., after 20 months of daily use, and after almost 5 Terabytes of writing, i guess i could probably select the 10 biggest files from home,
and copy them back & forth to an external disk...to gain myself a 2% improvement in read operations of my personal files... :lol:
ext4 knows it's job just fine :-)
Exactly. Just make sure that at least 20 % remains always unused in each Linux partition, and all will be well with the fragmentation "issue"....
Tip: 10 things to do after installing Linux Mint 19 Tara
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.

User avatar
trytip
Level 8
Level 8
Posts: 2053
Joined: Tue Jul 05, 2016 1:20 pm

Re: Defrag

Post by trytip » Fri Jun 15, 2018 9:41 am

fragmentation happens in the filesystem so if your linux is installed on ntfs or fat32 then by all means defragment. if you have ext2-4 which pretty much encompasses the spectrum of all linuxes defragmenting is only a placebo.

sure it will find something to defragment but it's all mainly files in the .cache folder that gets deleted and updated as you open chrome or other programs

you wanna know how i defragment my linux? i delete everything in .cache/

ps: if you have WD drive check that intellipower status is disabled as doing extra spinning actions like checking defrag can ruin drive. install idle3-tools and check with sudo idle3ctl -g103 /dev/sdb replace sdb with your WD drive
Image

DAMIEN1307
Level 5
Level 5
Posts: 971
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico

Re: Defrag

Post by DAMIEN1307 » Fri Jun 15, 2018 2:40 pm

I make many, many changes, downloads, deletions, etc. in my different computers and systems as im always experimenting with different things here...i DO defrag about ONCE PER YEAR even though as previously mentioned in the above posts that it is probably NOT necessary and possibly even dangerous...fortunately i have never personally experienced any problem in so doing but does not mean that others will not have problems...if anyone feels that they just MUST do so, this is the terminal command to accomplish this...DO SO ONLY AT YOUR OWN RISK...DAMIEN

use this command if your "boot" is incorporated in the main filesystem partition as can be ascertained by viewing "disks"

Defrag Command

sudo e4defrag /dev/sda1

use this command if your "boot" is a separate filesystem partition as can also be viewed in "disks"

Defrag Command

sudo e4defrag /dev/sda2
ORDO AB CHAO

User avatar
jimallyn
Level 18
Level 18
Posts: 8419
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: Defrag

Post by jimallyn » Fri Jun 15, 2018 5:43 pm

When I learned, maybe six months or a year ago, that there actually was a defragger for Linux, I thought I'd try it, just for grins. It scanned the drive and said it didn't need defragging, even after years of adding, editing, and deleting files. So, I had always heard that Linux file systems don't need defragging, and my experience confirmed it for me.
Image

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan

User avatar
slipstick
Level 5
Level 5
Posts: 774
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: Defrag

Post by slipstick » Fri Jun 15, 2018 6:16 pm

I have a 100 GB Data partition that is about half full. I have been using this for four years without defragging and sudo e4defrag -c /dev/sda7 say 0 % fragmentation. As for my / and /home partitions, I have one of each for odd-numbered major versions and for even-numbered major versions. When I think that LM19 is stable enough to install, I'll format the old LM17 / and /home partitions and install LM19, while keeping LM18.3. So if I reformat / and /home every couple of years, fragmentation shouldn't be a problem. And for the Data partition, it seems I'll be fine as long as I leave plenty of spare space.
In theory, theory and practice are the same. In practice, they ain't.

Post Reply

Return to “Software & Applications”