How to analyze and defragment drive in ubuntu 16.04

6,572

Ubuntu doesn't need disk-defragmenting

From this article:

If you’re a Linux user, you’ve probably heard that you don’t need to defragment your Linux file systems. You’ll also notice that Linux distributions don’t come with disk-defragmenting utilities. But why is that?

To understand why Linux file systems don’t need defragmenting in normal use – and Windows ones do – you’ll need to understand why fragmentation occurs and how Linux and Windows file systems work differently from each other.

Share:
6,572

Related videos on Youtube

Eka
Author by

Eka

Updated on September 18, 2022

Comments

  • Eka
    Eka over 1 year

    I want to check whether my root drive requires a defragmentation. If requried I am planning to do this sudo e4defrag -c /dev/<my partition> I followed this method to analyze my disk.

    sudo touch /forcefsck
    sudo tune2fs -c 1 /dev/<my partition>
    

    Then I rebooted my system but its showing nothing on my reboot and directly goes to the login page. How to analyze and defrag a drive in ubuntu 16.04?

    • 24601
      24601 about 6 years
      Have you considered downloading Bleachbit from the Ubuntu Software Centre?
    • Eka
      Eka about 6 years
      I did this sudo bleachbit -c --preset for clearing my system. But it exits after sometime with a error filesystem root has 99 MB left. Tried unchecking some options and rerun bleachbit but the problem still exists. Thats why I am not going to go bleachbit way
    • sudodus
      sudodus about 6 years
      I suggest that you try to repair the root file system. Boot from another drive, for example an Ubuntu install drive (USB or DVD) and run an e2fsck command according to this link. Scroll down to 'Repair linux file systems with linux tools'.
    • Panther
      Panther about 6 years
      Looks like the problem is your partition is full . Significant fragmentation is very rare in linux
    • Panther
      Panther about 6 years
      sudo fsck.ext2 -fn /dev/sdXY will show fragmentation. The problem probably is your partition is full
  • Panther
    Panther about 6 years
    Although very rare one can see significant fragmentation in Linux. This happens when the partition is full and the op suggests this may be the case
  • John
    John about 3 years
    So, the answer (from the article) in case your drive is full and fragmented is: Free up some space (delete some files), copy remaining files to a new drive, erase the old drive, then copy the files back to the old drive. Voila! Fragmentation gone. Seems like there is room for improvement there.