JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

How to Defragment your hard disk

Defragment your hard disk

Fragmentation mainly affects big files that will not fit into the free space on a hard disk, so the file is broken up into pieces to fit on it. In other words, its content is scattered all over your hard disk in a somehow chaotic manner. Defragment your hard disk is a good habit, it is the process to reorganize non-contiguos files into contiguos files to optimize your hard drive and increase your PC performance.  

❯ sudo umount /media/mydisk2 # Firstly, make sure you umount the partition.
❯ sudo e2fsck -fn /dev/sdb1 # Secondly, we check the partition. The output shows that there are only 0.8 percent of non-contiguos blocks, so it is pretty OK.
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
mydisk2: 1512000/122093568 files (0.8% non-contiguous), 167738935/488369920 blocks
❯ sudo mount /media/mydisk2 
❯ sudo e4defrag /dev/sdb1 # Let's defragment the partition. e4defrag needs the file system to be mounted.
❯ sudo e4defrag / # Finally, this is how to defragment all your partitions.
Defragging an SSD is usually a bad idea because an SSD has a limited number of read and write cycles and defragging it will shorten its lifespan. Besides, a SSD has no mechanical parts and your operating system can read each sector at roughly the same speed.
Bitcoin donation

JustToThePoint Copyright © 2011 - 2022 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.