LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   defragmentation-of-linux-filesystems (http://www.linuxquestions.org/questions/linux-general-1/defragmentation-of-linux-filesystems-4175442926/)

BeniBela2 12-25-2012 08:11 AM

defragmentation-of-linux-filesystems
 
Quote:

Originally Posted by robert.wolfe (Post 4572224)
:

polishlinux.org/apps/cli/defragmentation-of-linux-filesystems/

Just remember that it is a good idea to have a least 10% of the filesystem you want defragmented available for the entire process to be successful. And don't forget, UNMOUNT THE AFFECTED FILESYSTEM BEFORE YOU RUN DEFRAGMENT!


That link links to download.tuxfamily.org/optimization/OptimizationKit/v0.1/tmp/ for ok_defrag, which returns 404.

Does anyone has a new link?


I think I desperately need to defrag my file system:

Code:

$ ls -Alh hg/programs/internet/VideLibri/videlibri
-rwxr-xr-x 1 benito benito 26M Dec 24 14:17 hg/programs/internet/VideLibri/videlibri
$ filefrag hg/programs/internet/VideLibri/videlibri
hg/programs/internet/VideLibri/videlibri: 747 extents found, perfection would be 1 extent

$ ls -AlrSh ~
[...]
-rw-r--r--  1 benito benito  13M Jan 15  2011 project1.exe
-rw-r--r--  1 benito benito  13M May 31  2010 Stein.pdf
-rw-r--r--  1 benito benito  13M Mar 25  2010 xxx.flv
-rw-r--r--  1 benito benito  23M Mar  2  2010 vogeldatabase.tar.bz2
-rw-r--r--  1 benito benito  3.3G Jul 26 10:23 9200.16384.WIN8_RTM.120725-1247_X64FRE_ENTERPRISE_EVAL_EN-US-HRM_CENA_X64FREE_EN-US_DV5.ISO?lcid=1033
$ filefrag 9200.16384.WIN8_RTM.120725-1247_X64FRE_ENTERPRISE_EVAL_EN-US-HRM_CENA_X64FREE_EN-US_DV5.ISO\?lcid\=1033  vogeldatabase.tar.bz2 xxx.flv Stein.pdf project1.exe
9200.16384.WIN8_RTM.120725-1247_X64FRE_ENTERPRISE_EVAL_EN-US-HRM_CENA_X64FREE_EN-US_DV5.ISO?lcid=1033: 7344 extents found, perfection would be 1 extent
vogeldatabase.tar.bz2: 160 extents found, perfection would be 1 extent
xxx.flv: 230 extents found, perfection would be 1 extent
Stein.pdf: 7 extents found, perfection would be 1 extent
project1.exe: 8 extents found, perfection would be 1 extent

$ ls -AlrSh /tmp
...
-rw-r--r--  1 firefox firefox 844K Aug  3 00:53 hC29318.fmt
-rw-r--r--  1 firefox firefox 844K Aug 17 21:21 hZb7071.fmt
-rw-r--r--  1 firefox firefox 845K Aug 17 21:21 hBC7071.fmt
-rw-r--r--  1 benito  benito  847K Oct 11 22:36 crap
-rw-------  1 firefox firefox 1.5M Dec 24 23:36 clipboardcache
-rw-r--r--  1 benito  benito  1.7M Dec 24 15:05 videlibri-1.301.src.tar.gz

$ sudo filefrag hBC7071.fmt hZb7071.fmt hC29318.fmt crap clipboardcache videlibri-1.301.src.tar.gz
hBC7071.fmt: 14 extents found, perfection would be 1 extent
hZb7071.fmt: 25 extents found, perfection would be 1 extent
hC29318.fmt: 5 extents found, perfection would be 1 extent
crap: 3 extents found, perfection would be 1 extent
clipboardcache: 10 extents found, perfection would be 1 extent
videlibri-1.301.src.tar.gz: 15 extents found, perfection would be 1 extent

$ df
Filesystem    1K-blocks      Used Available Use% Mounted on
rootfs        192251960 182113376    372680 100% /


onebuck 12-25-2012 05:32 PM

Moderator Response
 
Moved: This thread is more suitable in <Linux-General> and has been moved accordingly to help your thread/question get the exposure it deserves.

-----

Correct link: http://polishlinux.org/apps/cli/defr...x-filesystems/

John VV 12-25-2012 08:05 PM

Also ect3 and 4 and even the old ext2 file systems do not need to be "defraged"
that is a issue with Microsoft and there operating system

except is very rare occasions

dru8274 12-30-2012 06:34 PM

I'm not sure exactly which filesystem you are using. But if it is ext4, then you might use e4defrag, which is part of the e2fsprogs package.
Quote:

e4defrag - online defragmenter for ext4 filesystem

e4defrag reduces fragmentation of extent based file. The file targeted by e4defrag is created on ext4 filesystem made with "-O extent" option (see mke2fs(8)). The targeted file gets more contiguous blocks and improves the file access speed.
Happy with ur solution... then tick "yes" and mark as Solved!

H_TeXMeX_H 12-31-2012 04:23 AM

There is also a defrag program for XFS.

For other filesystems try my script:
http://www.linuxquestions.org/questi...7/#post4841091

BeniBela2 12-31-2012 07:26 PM

Sound nice.

But I use ext3

sundialsvcs 01-01-2013 07:03 PM

Quote:

Originally Posted by John VV (Post 4856753)
... that is a issue with Microsoft and there operating system

And even then, only for FATx filesystems, and then only if and when you really care anymore. (As mass-storage devices become semiconductor based, you won't care anymore...) Microsoft's later filesystems like NTFS have better space-allocation mechanisms, and disk drives and controllers are considerably smarter and faster.

DavidMcCann 01-02-2013 01:08 PM

On a drive that had been intensively used for 8 years, fsck revealed 14% non-contiguous files. A check on the web shows people saying that you needed to defrag a Windows drive if that figure gets to 35%. Is your data ominous? Frankly, I can't make much sense of the program output!

H_TeXMeX_H 01-02-2013 01:34 PM

Quote:

Originally Posted by BeniBela2 (Post 4860349)
Sound nice.

But I use ext3

My script should work with any filesystem, but use it at your own risk. I have been using it for a while.


All times are GMT -5. The time now is 04:44 PM.