- 1). Unmount the drive you want to defragment. You can do this by clicking on the "Places" menu and right-clicking on the drive in the menu on the far left. Then click on the "Unmount" option. You can also do this by running the following command in the terminal window:
umount /dev/hda3
Substitute "/dev/hda3" with the location of your hard drive. If it is the same drive or partition that your operating system runs from, you may need to reboot using a Ubuntu LiveCD. - 2). Open a terminal window from the "Applications," "Accessories," "Terminal" menu.
- 3). Enter the following command into the terminal window:
fsck -t ext3 /dev/hda3
If you have a different type of formatting on the drive, substitute it for "ext3." For "/dev/hda3," substitute the location of the drive you want to defragment. Repeat this step until it returns a response that says that the drive is okay. Running the command once and having it fix something may uncover additional problems afterward. - 4). Remount the drive with the following command in the terminal window:
mount /dev/hda3
Substitute "/dev/hda3" with the location of your hard drive.