Loading...
X

How to find out the number of starts and the total working time of a disk in Linux

You can find out how many hours any hard drive or solid state drive has run. You can also view information about the number of times the disc has been turned on. Some discs store information about the total amount of data read and written, as well as unexpected shutdowns (for example, due to a computer freeze or power outage). All this data is stored in S.M.A.R.T.

Since the disk in a computer is the only non-volatile storage location, it can preserve its entire history and history of using the computer.

First, we need to find out the names of the drives in the system. Run the command to get a list of drives.

sudo fdisk -l

On my system, there are three disks named:

  • /dev/nvme0n1
  • /dev/sda
  • /dev/sdb

Let's see the information about the running time of each of them.

To do this, we will use a command of the form:

sudo smartctl -A DRIVE_ NAME

For example, to view information about /dev/nvme0n1:

sudo smartctl -A /dev/nvme0n1

  • Data Units Read - information read (in the example shown 11591976 units or 5.93 TB)
  • Data Units Written - information is written (in the example shown, 17703364 units or 9.06 TB)
  • Power Cycles - how many times the computer was turned on (2373 times)
  • Power On Hours - hours of operation (2371 hours)
  • Unsafe Shutdowns - not normal shutdowns (185 times)

The information displayed may differ depending on the type of disc and its model. For example, let's see the information about the drive named /dev/sda:

sudo smartctl -A /dev/sda

As you can see, the data is presented differently and the dataset is also different.

  • Power_On_Hours - the number of hours of work
  • Power_Cycle_Count - number of booting

Finally, let's look at the information from the /dev/sdb drive:

sudo smartctl -A /dev/sdb

Here we see the already familiar fields Power_On_Hours and Power_Cycle_Count, but the dataset has changed.

So, the smartctl utility is designed to display information about the health and operating time of hard drives and solid state drives.

The dataset and its presentation varies from disc to disc. For example, the first drive is an NVMe drive; the second disk is an HDD disk, so there is more data on the statistics of mechanical parts; and the third drive is an SSD SATA drive.

If you want to get the most complete information, including all SMART information on the disk, then use the -a, --all option:

sudo smartctl -a /dev/DISK

For instance:

sudo smartctl -a /dev/nvme0n1

If you want to know even more about solid state drive or hard drive, see the article “How to know when the ext4/ext3/ext2 filesystem was created and when it was last mounted”.


Leave Your Observation

Your email address will not be published. Required fields are marked *