Open the terminal (CTRL + ALT + T)
$ sudo apt-get update
$ sudo apt-get install e4defrag
Open the terminal (CTRL + ALT + T)
$ sudo e4defrag -c /
$ sudo e4defrag -v /
or only directory
$ sudo e4defrag -c /home/
ibm@ibmr60e-ThinkPad-R60e:~$ sudo e4defrag
Usage : e4defrag [-v] file...| directory...| device...
: e4defrag -c file...| directory...| device...
ibm@ibmr60e-ThinkPad-R60e:~$ sudo e4defrag -c /
<Fragmented files> now/best size/ext
1. /var/log/syslog 2/1 4 KB
2. /var/log/lastlog 2/1 6 KB
3. /home/ibm/.mozilla/firefox/ilpwg9sp.default/cert8.db
2/1 66 KB
4. /home/ibm/.config/chromium/BrowserMetrics-active.pma
6/1 182 KB
5. /home/ibm/.config/chromium/Default/Current Session
3/1 172 KB
Total/best extents 121685/121597
Average size per extent 97 KB
Fragmentation score 0
[0-30 no problem: 31-55 a little bit fragmented: 56- needs defrag]
This directory (/) does not need defragmentation.
Done.
ibm@ibmr60e-ThinkPad-R60e:~$ sudo e4defrag -v /
....
...
..
[179130/179143]/bin/mount: 100% extents: 1 -> 1 [ OK ]
[179131/179143]/bin/unicode_start: 100% extents: 1 -> 1 [ OK ]
[179132/179143]/bin/loadkeys: 100% extents: 1 -> 1 [ OK ]
[179133/179143] "/bin/bzcmp"
File is not regular file [ NG ]
[179134/179143]/bin/udevadm: 100% extents: 1 -> 1 [ OK ]
[179135/179143]/bin/sleep: 100% extents: 1 -> 1 [ OK ]
[179136/179143]/bin/zgrep: 100% extents: 1 -> 1 [ OK ]
[179137/179143]/bin/ed: 100% extents: 1 -> 1 [ OK ]
[179138/179143]/bin/ntfsfix: 100% extents: 1 -> 1 [ OK ]
[179139/179143]/bin/bzcat: 100% extents: 1 -> 1 [ OK ]
[179140/179143]/bin/loginctl: 100% extents: 1 -> 1 [ OK ]
[179141/179143]/bin/ntfsdump_logfile: 100% extents: 1 -> 1 [ OK ]
[179142/179143]/bin/gzip: 100% extents: 1 -> 1 [ OK ]
[179143/179143]/bin/kbd_mode: 100% extents: 1 -> 1 [ OK ]
Success: [ 121512/179143 ]
Failure: [ 57631/179143 ]
Total extents: 121583->121575
Fragmented percentage: 0%->0%