Linux Disk Utilities
Linux Disk Utilities have come along way over the years. Here we will discuss some different disk types and how to manage under some various linux flavors. A primary focus will be on disk health, such as the equivalent to performing a 'scandisk' for Linux users.
UltraATA disks have S.M.A.R.T. technology. These disks perform self-monitoring, analysis, and reporting by internally monitoring their own operation. Older IDE disks required software tools or system tools to perform such operations.
Example 1: Disk Health on Linux Mint system
In this example we are on a Linux Mint 16 "petra" machine with a 160GB SATA drive.
- Goto: Menu, Control Center, Hardware, Disks
- In the Devices pane on the left select the disk
- Click on the "gear" icon in the upper right of the Disks dialog box and a drop down menu appears
- choose "SMART Data & Self-Tests..." from that menu
These instructions should be close to identical on Ubuntu, Debian, and other similar distributions.
The disk utility lets you see the model, serial number, firmware, and the overall health assessment of the hard disk, as well as whether a SMART system is enabled on the hard disk.
The ‘Run Self-test’ button lets you initiate a short,extended, or a conveyance self-test on the hard disk.
The ‘Attributed section’ lets you see the errors and self-test information.
Example 2: fsck on any Linux system
The File System Check (fsck) is a command line utility that can be used to check the condition of the hard drive.
fsck -f /dev/hdaX
You should not use fsck on a mounted drive. In general it is not safe to run fsck on mounted filesystems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified. However, even if it is safe to do so, the results printed by fsck are not valid if the filesystem is mounted.
Running fsck on a mounted file system is not recommended because logically, it will be trying to analyze for inconsistencies on effectively a changing drive. The action of modifying the filesystem means that anything that has been analyzed will have to be rechecked again and again, because it just keeps changing.
You can force an fsck on most linux distributions for a mounted drive, while it is not yet mounted, during the next reboot.
sudo touch /forcefsck shutdown -r now
Or, the shutdown command with parameters that will force a fsck check on reboot
shutdown -rF now
That says "reboot and fsck before mounting!"
Example 3: Disk Utility, Check Filesystem and GParted
This is a GUI alternative to fsck.
Disks 3.4.1 (aka palimpsest, gnome-disk-utility, or Disk Utility) underwent a huge UI change. Users of Ubuntu 12.04 Precise will not experience this issue because Disks 3.4.1 is only available via PPA or in the next Ubuntu release, 12.10 Quantal.
Disks 3.3+ is a complete rewrite of the old gnome-disk-utility (aka Palimpsest). It no longer appears to include an option to check filesystems
Use GParted to check filesystems instead. Select the partition you want to check, click on Partition...Check in the menu