6
3/21/2014 The Beginner’s Guide to Linux Disk Utilities http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 1/6 The Beginner’s Guide to Linux Disk Utilities Knowing how to check the condition of your hard disk is useful to determine when to replace your hard disk. In today’s article, we will show you some Linux disk utilities to diagnose the health of your hard disk. Image by Scoobay S.M.A.R.T System Most modern ATA and SCSI hard disks have a Self-Monitoring, Analysis, and Reporting Technology (SMART) system. SMART hard disks internally monitor their own health and performance. The SMART tool assesses the condition of your hard disk based on: the throughput of the hard disk, the seek errors rate of the magnetic heads, and other attributes that your hard disk manufacturer built into their hard disk. Most implementations of SMART systems allow users to perform self-tests to monitor the performance and reliability of their hard disks. The simplest way to perform a SMART system test with Ubuntu is using the ‘Disk Utility’ under the ‘System’ > ‘Administration’ menu. How-To Geek

The Beginner’s Guide to Linux Disk Utilities

Embed Size (px)

Citation preview

Page 1: The Beginner’s Guide to Linux Disk Utilities

3/21/2014 The Beginner’s Guide to Linux Disk Utilities

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 1/6

The Beginner’s Guide to Linux Disk Utilities

Knowing how to check the condition of your hard disk is useful to determine when to replace your hard disk. In today’s article, wewill show you some Linux disk utilities to diagnose the health of your hard disk.

Image by Scoobay

S.M.A.R.T System

Most modern ATA and SCSI hard disks have a Self-Monitoring, Analysis, and Reporting Technology (SMART) system. SMART harddisks internally monitor their own health and performance.

The SMART tool assesses the condition of your hard disk based on: the throughput of the hard disk, the seek errors rate of themagnetic heads, and other attributes that your hard disk manufacturer built into their hard disk.

Most implementations of SMART systems allow users to perform self-tests to monitor the performance and reliability of their harddisks. The simplest way to perform a SMART system test with Ubuntu is using the ‘Disk Utility’ under the ‘System’ >‘Administration’ menu.

How-To Geek

Page 2: The Beginner’s Guide to Linux Disk Utilities

3/21/2014 The Beginner’s Guide to Linux Disk Utilities

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 2/6

The disk utility lets you see the model, serial number, firmware, and the overall health assessment of the hard disk, as well aswhether a SMART system is enabled on the hard disk.

The ‘SMART data’ button lets you see the SMART features of your hard disk.

The ‘Run Self-test’ button lets you initiate a short,extended, or a conveyance self-test on the hard disk.

Page 3: The Beginner’s Guide to Linux Disk Utilities

3/21/2014 The Beginner’s Guide to Linux Disk Utilities

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 3/6

When you execute these tests, you’ll see a progress meter, letting you see how far through the test is and what the estimatedtime of completion is.

The ‘Attributed section’ lets you see the errors and self-test information.

File System Check

There some other tools, beside the Disk Utility GUI, that we can use to diagnose the health of our hard disk. The File System Check(FSCK), that only comes as a command line tool, is one of the tools that we often use to check the condition of our hard disk.

You can use the ‘Check Filesystem’ feature of the ‘Disk Utility’ to perform the same check,if you are not a command line geek likeus.

Page 4: The Beginner’s Guide to Linux Disk Utilities

3/21/2014 The Beginner’s Guide to Linux Disk Utilities

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 4/6

Of course, there are some situations where we have to use the command line tool to check our file system. For example when weare using a headless system, when our Linux box fails to boot, or when we simply want to show off our command line Kungfu skillsto our friends.

At first, the FSCK command line tool looks like something that only a computer geek can handle; But you will find that FSCK is avery easy tool to use. There is one thing to note before you run FSCK; You need to unmount the file system using the ‘umount’command. Fixing a mounted file system with FSCK could end up creating more damage than the original problem.

sudo umount /dev/sdb

The FSCK command is pretty straightforward:

sudo fsck -t ext4 /dev/sdb

This command checks an ext4 file system (/dev/sdb) for inconsistencies. You should replace /dev/sdb with your own partition. Youcan run the ‘fdisk’ command to find out your system partitions:

sudo fdisk -l

Scheduled File System Checks

If you’re using Ubuntu, you will notice that Ubuntu runs an FSCK session when you boot your system from time to time. If you findthis scheduled check annoying, you can re-schedule the scan using the ‘tune2fs’ command. Here’s how it typically looks like:

The mount count parameter tells us that Ubuntu scans our hard disk after 33 disk mounts.

Page 5: The Beginner’s Guide to Linux Disk Utilities

3/21/2014 The Beginner’s Guide to Linux Disk Utilities

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 5/6

Zainul spends his time trying to make technology more productive, whether it’sMicrosoft Office applications, or learning to use web applications to save time.

Published 12/15/10202,056 Views

We can configure the mount count using the ‘-c’ option:

sudo tune2fs -c 35 /dev/sda1

This command will re-configure Ubuntu to scan our hard disk after 35 hard disk mounts when the system boots.

Note: change ‘/dev/sda1/’ with your own partition

Bad Blocks

A bad sector is a sector on a computer’s disk drive that cannot be used due to permanent damage (or an OS inability tosuccessfully access it), such as physical damage to the disk surface.

There are two ways to detect bad sectors in Linux: you can use the Disk Utility GUI, or if you are a command line geek like us, youcan use the badblocks command to check your hard disk for bad sectors:

sudo badblocks -v /dev/sdb1

Badblock will give us the number of bad sectors in our hard disk.

zainul@zainul-laptop:~$ sudo badblocks -v /dev/sdb1Checking blocks 0 to 97683200Checking for bad blocks (read-only test): 3134528 done, 3:27 elapsed3134560 done, 8:33 elapsed3134561 done, 10:15 elapsed3134562 done, 11:57 elapsed3134563 done, 13:39 elapseddonePass completed, 5 bad blocks found.

You have two options when you see bad blocks. You can either look for a new hard disk, or mark these bad blocks as unusablehard disk sectors. This involves two steps:

First we have to write the location of the bad sectors into a flat file.

sudo badblocks /dev/sdb > /home/zainul/bad-blocks

After that, we need to feed the flat file into the FSCK command to mark these bad sectors as ‘unusable’ sectors.

sudo fsck -l bad-blocks /dev/sdb

FSCK, Badblocks, and Disk Utility are some of the disk utilities that we often use to scan our hard disks. Do share with the otherfellow readers if you know other Linux disk utilities to scan hard disks.

Page 6: The Beginner’s Guide to Linux Disk Utilities

3/21/2014 The Beginner’s Guide to Linux Disk Utilities

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ 6/6

Got Feedback? Join the discussion at discuss.howtogeek.com

SHOW ARCHIVED READER COMMENTS (14)

FROM THE WEB by TaboolaSponsored Content

‘Warren Buffett

Indicator’ Signals

Collapse in Stock M…

Newsmax

7 of the Worst

Defending Champions

in History

ftbpro

The Secret Way to

Save Hundreds of

Dollars on 5-star Ho…

A Luxury Travel Blog

Inside Look At

Porsche’s 2015 911

GT3 RS

Segment.com

Top Exercises That

Will Kill Your Cellulite

Lifegooroo

Life and Photography

with Multiple

Sclerosis

Living Like You

20 World's Most

Peaceful Countries to

Live

Amerikanki

10 Most Dangerous

People Foods for

Dogs

Womanitely