-2

How to install and execute e2defrag on KuBuntu?

http://launchpad.net/e2defrag

From the link:

Utility for offline defragmentation of ext[234] filesystems.

This poor ancient package used to be known as the defrag packge but was removed from Debian and hence Ubuntu due to it not having had a maintainer in many years and suffering from bit rot. I am rescuing it from the bit bucket.

Alex S
  • 165
  • Software last updated in 2012 should be ignored. Or updated by someone. Oh and I removed the personal opinion. It distracts from the question (besides it being totally wrong ...) – Rinzwind Apr 18 '17 at 13:58
  • @Rinzwind - It was not a personal opinion. It was to discourage & give some facts to every Linux user from claiming they know everything about how Ext FS never get fragmented etc - The primary comments & arguments that everyone keeps making. – Alex S Apr 19 '17 at 08:22
  • Nobody ever claimed it does not. The claim is that on ext it only happens at roughly 95% full system and it fixes itself when you move a fragged file across filesystems or partitions. Besides that it does not improve speed what the main issue was on Windows. Defragging a Linux fs (not in a VM) is a waste of time since you do not fix the problem: the reason it started defragging files. Not coming back for this. – Rinzwind Apr 19 '17 at 10:53
  • @Rinzwind - "Nobody"? You want me to link and point out the number of such comments, despite the statement of acknowledgement that yes Ext is good & usually doesnt need defrag, but said scenario has "fragmented condition" and one would like to & "choose" to Defrag. – Alex S Apr 20 '17 at 08:03

1 Answers1

2

You don't mention which version of Ubuntu you are using but packages are only available for 14.04 through 15.10 at this time as it's been almost 2 years since the PPA has been updated. Since 14.04 is the only one of these currently supported, I'm providing instructions for that version.

For 14.04

Run the following commands in a terminal

sudo add-apt-repository ppa:dpmva1/ppa
sudo apt-get update
sudo apt-get install e2defrag

EDIT from man page:

Note  that  unlike  the  fsck  program,  defrag MUST NOT be run on a mounted file system device
       (unless invoked with the -r (readonly) option, which is always safe).  Also note  that  if  you
       defragment  a  partition  containing  a bootable kernel image and are using lilo ( grub doesn't
       care unless you have it installed in the partition using blocklists instead of the MBR  ),  you
       will  have to reinstall the boot loader for that image (since the location on disk of the image
       may have changed).

       Remember, if defrag fails to complete for any reason (including  power  glitches,  kernel  bugs
       etc.), you will be left with a terminally sick, and possibly completely unreadable, filesystem,
       so backup any valuable data before you start.

Installation tested on 14.04.5 I have no reason to expect the point release is relevant.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • I can download the older Live CD if needed, to run this, but will the above lines still add the packages (to older versions)? If the repo is not alive, is there anyway I can download the .DEB etc manually and install using GDebi etc? – Alex S Apr 18 '17 at 01:39
  • So, it will work on any Ubuntu derivative as long as based on 14.04-15.10 (Same lines for 15.10 as well?) – Alex S Apr 18 '17 at 01:41
  • 1
    PPA tested active and installation successful for 14.04. I no longer utilize any of the out of support versions. It can't hurt to try though. See my updated answer for important information. – Elder Geek Apr 18 '17 at 01:46
  • Interesting note. But if I defray said Hdd volume from an external entity, such as a live cd or usb then I'm not at risk for said corruption or at lesser risk. Right? Ps: anyway to find and get the Deb and keep it for local Gdebi installation? – Alex S Apr 18 '17 at 02:07
  • 1
    Wrong. You have to mount the device to use e2defrag Ignore the warning from the man page at your own risk. After installation you can find the package in the usual spot. /var/cache/apt/archives/e2defrag_0.81-0~50~ubuntu14.04.1_amd64.deb :-) It's always a good idea to have a backup anyway – Elder Geek Apr 18 '17 at 02:14
  • Thank you, warning duly noted. I meant where online is the Deb actually located so that I can download it and do a local install in case I am not able to make the online repo + Install happen? I couldnt find where the Deb is stored online in terms of URL. – Alex S Apr 18 '17 at 04:05
  • One last thought - Does this/ will this work with any 14.04.x - Sub release LTS as https://wiki.ubuntu.com/Releases shows .0 .1 .2 .3 .4 .5 for 14.04? Then I should be getting the .0 or the .5? – Alex S Apr 18 '17 at 04:52
  • 1
    Updated answer. – Elder Geek Apr 18 '17 at 13:22
  • Not working on Ubuntu 20.04 – Sridhar Sarnobat Jul 20 '22 at 19:57
  • @SridharSarnobat I recommend that you read both the question and the answer carefully along with the previous comments, and take the respective dates and versions into consideration. It's not expected to work on 20.04 – Elder Geek Aug 23 '22 at 21:25
  • So is e2defrag actually able to defrag free space too? Cause e4defrag cannot. But e4defrag is safe. https://unix.stackexchange.com/questions/472120/how-to-kill-terminate-running-e4defrag-without-damaging-my-data – Валерий Заподовников Jun 07 '23 at 03:31
  • @Bалерий Заподовников Free space fragmentation is the result of files/folders defragmantation. It's an expected result free space is fragmented by the process of defragmenting files. Think it over – Elder Geek Jul 23 '23 at 21:21