How to Fix Disk Errors in Ubuntu
Typically, a computer running Ubuntu 14.04 LTS uses EXT4 as its default file system, which determines how files are stored and organized on the machine's hard drive. Although the EXT4 file system features journaling, which protects the file system from corruption during events such as power outages, you may still encounter disk errors. Some of the more common issues are related to master boot record problems, unrecognized drives, file permission issues or general file system corruption.
File System Corruption
This typically happens when the write process is interrupted while saving files to the hard disk, such as during a power failure, leaving errors in the file system. To repair the file system, run the file system check, or fsck, command when the file system is not mounted or in use. If Ubuntu still boots, start it up, open a terminal session, type “sudo touch /forcefsck”, and then press the “Enter” key. Type your password when prompted, and then press “Enter” again. This schedules the fsck command to run at the next startup. To check the system immediately, choose “Restart” from the “Shutdown” menu. If Ubuntu won't boot, start the system using the Ubuntu install disk, then choose “Try Ubuntu.” Search for and start the Disks program to find the device label for your hard disk -- it begins with “/dev” and is described as a bootable Linux partition. Start a terminal session, type “sudo fsck -y /dev/sda” at the prompt, replacing “/dev/sda/” with the device label for your hard disk, and then press “Enter.” Type your password when requested. When the command is finished, restart your computer and allow it to boot normally.
Overwritten Master Boot Record
When Ubuntu won't boot at all and no boot menu is displayed, it is usually because a second operating system, such as Windows, has overwritten the master boot record. To repair this, start your computer with the Ubuntu disc, open a terminal session, and then run the “sudo grub-install /dev/sda” command at the prompt, replacing “/dev/sda/” with the label for your hard drive. Press “Enter,” and then type your password when requested.
Drive Not Recognized
When an external drive is plugged in, the system should find it automatically. If not, start the Disks program, click on your drive in the left pane, and then click the triangle-shaped button in the right pane to mount the drive, which will allow you to browse the files. If the drive is new, you may need to first format it via the gear-shaped More Actions button. Note that formatting erases any data on the drive. Choose the default EXT4 option if you will be using the drive on Linux only; choose the NTFS option for use on Linux and Windows machines; or choose the FAT option for use on most machines.
Improper File Permissions
If you have files from another Linux machine or an account on an external drive, you may find that your standard user account cannot open the files. To gain access, you need to grant your account the proper rights for those files. Open a terminal session, enter the command “sudo nautilus” at the prompt, press “Enter,” and then type your password. In the Nautilus file manager, browse to the files or folders you would like to access, right-click each and select “Properties” from the context menu, click on the “Permissions” tab, and then set both Owner and Group to the name for your Ubuntu account.