5

I started using Linux recently. On windows (which I've used all my life) to keep the HD tidy there are several tools, e.g. disk cleanup and defragger. On Linux what should I do to tidy up a hard disk.

I'm using Linux Mint.

11
  • What kind of Linux system are you using (e.g. what distribution)? Also, what kind of file system are you using? Many consider that defragmentation is not needed in Linux, see e.g. geekblog.oneandoneis2.org/index.php/2006/08/17/…
    – N.N.
    Aug 10, 2011 at 13:17
  • I'm using Linux Mint. What file system? I don't know. The Linux file system (I thought there was only one)
    – P_Q
    Aug 10, 2011 at 13:18
  • You can find out your file system by running cat /etc/fstab. The file system type is listed under "<type>".
    – N.N.
    Aug 10, 2011 at 13:22
  • You might find askubuntu.com/questions/21587/how-do-i-clean-up-my-harddrive interesting.
    – N.N.
    Aug 10, 2011 at 13:28
  • 2
    Practically every modern OS comes with various types of file systems supported: Windows has NTFS and ton of FAT variants, Linux support EXT3, EXT4, EXT2, ReiserFS, FAT, NTFS and several others. The default is usually EXT3 for Linux and NTFS for Windows, if you do fresh install of newest released OS version this year.
    – Zds
    Aug 10, 2011 at 13:45

4 Answers 4

3

EXT3, the usual default file system for Linux systems, is resistant to fragmentation and does not usually need defragmentation. The only files you really need to clean up are the ones you create yourself. In other words, you don't need to schedule it; only if there is something obviously wrong and traces point to fragmentation you might want to do it.

2
  • What about temp internet files, caches etc?
    – P_Q
    Aug 10, 2011 at 13:57
  • 1
    @user90548 you don't need to worry about those even on windows as browsers limit the size of the cache and automatically throw out old junk to keep the size reasonable.
    – psusi
    Aug 10, 2011 at 14:41
2

There are several ways in which you can tidy your Linux Mint system. Here's some.

Packages

Linux Mint uses the dpkg package management system. With the apt-get interface you can run

sudo apt-get autoremove

to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed. You can also run

sudo apt-get autoclean

to clear the local repository of retrieved package files are largely useless.

I prefer to use aptitude instead of apt-get. To autoclean with aptitude run

sudo aptitude autoclean

When removing or purging with aptitude it can automatically detect packages that are not needed so there is no equivalent of apt-get autoclean. However there is a utility that seem to find more unneeded packages than apt-get or aptitude. The utility is deborphan.

sudo deborphan 

It simply lists packages that are not needed by your system. It doesn't remove the unneeded packages. You'll have to do that yourself, e.g. by

sudo apt-get purge package-name

Disk space

To clear up disk space you can use a utility such as Baobab to check what is taking space and decide whether to keep it or not, e.g. let is scan your /home.

1
  • And for other who come along later, most package manager have some equivalent functionality. Aug 10, 2011 at 15:28
1

Generally, people often say that defragmenting ext2/3/4 filesystem is not needed. Don't get tricked; while these filesystems operate much better than the old DOS FAT, the fragmentation must be present anyway from principial reasons - though in much much smaller extent.

To check the fragmetation try these standard tools:

e2freefrag
fsck.ext3 -E fragcheck

I haven't found standard tools for defragmentation. There are some non-standard tools, you can try one of these links for more info:

http://en.wikipedia.org/wiki/Ext3#Defragmentation
http://www.webupd8.org/2009/10/defragmenting-linux-ext3-filesystems.html

But personally, I don't care about fragmentation on ext2/3/4 filesystems.

0

Windows with it's FAT or NTFS file systems tends to place files continuously one behind another from beginning of disk or partition. This leads to file fragmentation as these files are modified over time (files are split into multiple parts). Accessing a fragmented file may require several I/O calls (SLOW) to read that one file.

Linux file system such as ext3 or ext4 on the other hand tend to place files spread out over the disk with free space available so the file could grow without being split into fragments. That is why you do not have to worry about fragmentation while your disk usage is below 80%.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .