
Move your partitions back into the original order and regrow the partition you wanted defragged back to it's full size.Īnd I know you're not interested in why/why not to defrag ubuntu, but I'll post the link to why-is-defragmentation-unnecessary anyway. If you created a blank partition to have more than one on the disc, you can now delete it. Once it's done, shrink that partition back to it's previous size. This will move your partitions data to the end of the drive. grow the partition to the left of it to maximum size. With the partition you want to defrag as the last partition on the drive: Make sure the partition you want to defrag is the last partition on the drive by moving it to the end (you may have to create another blank partition in front of it if there's only one partition on the drive). Run gparted and shrink the partition that contains the data you want to defrag to just over the amount of your data. You also have to have more unused space available than used space for this to work and it may take a while. You have to boot from a CD/DVD/USB boot disc because the drive you're working on has to be unmounted. If you have enough space on your hard drive, you can use Gparted to defrag your file system ( ext2, ext 4, nfts, etc.). Your users can even run it on their own files, there's no need to be root unless you want to work on other user's or system files.Į4defrag is in the e2fsprogs package, and I guess it's already installed on your Ubuntu system. This directory (iso/) does not need defragmentation.Īs in this example, most of the time it will tell you that no defragmentation is needed, but if you want to do it anyway you can use (you don't need to use sudo to defrag your own files): e4defrag /path/to/myfiles Linux Lite 3.0 Humming on a ASRock N3070 Mobo btrfs RAID 10 Install on 4 Disks Computers Early days: ZX Spectrum(1982), HP-150 MS-DOS(1983), Amstrad CPC464(1984.
Here's an example of the output you can get: $ sudo e4defrag -c iso/ġ.
Just check fragmentation level with something like this (you need to be root to see details): sudo e4defrag -c /path/to/myfiles If your ext4 file system is created with the extent option (it's default in recent distros), you can use the e4defrag utility to check and defragment it online i.e.