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.
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.
There are several ways in which you can tidy your Linux Mint system. Here's some.
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
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
.
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.
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%.
cat /etc/fstab
. The file system type is listed under "<type>".