Does the kernel scan a disc, when it is mounted?

I have two (1 TB and 2 TB) NVMe SSDs and a 4 TB magnetical disc (where my backup lies) in my computer.

When I mount the mag. disc, then it seems, that the disc it scanned.
I/O and movement of the read/wirite head.

Is that normal ?

I don’t think so. Mine doesn’t do this when it gets mounted.

It might depend on the drive and how full it is, though.

You can check for errors with smartctl:

sudo smartctl --all /dev/sdX

Where /dev/sdX is the drive identifier. For example, /dev/sda.

Here is the log of smartctl:

smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.21-2-MANJARO] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Black
Device Model:     WDC WD4003FZEX-00Z4SA0
Serial Number:    WD-WCC130329608
LU WWN Device Id: 5 0014ee 25ddd5b66
Firmware Version: 01.01A01
User Capacity:    4.000.787.030.016 bytes [4,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sun Dec 12 09:30:59 2021 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82)	Offline data collection activity
					was completed without error.
					Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		(42780) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   2) minutes.
Extended self-test routine
recommended polling time: 	 ( 463) minutes.
Conveyance self-test routine
recommended polling time: 	 (   5) minutes.
SCT capabilities: 	       (0x7035)	SCT Status supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   189   145   021    Pre-fail  Always       -       9550
  4 Start_Stop_Count        0x0032   074   074   000    Old_age   Always       -       26112
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   100   253   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   087   087   000    Old_age   Always       -       10103
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   074   074   000    Old_age   Always       -       26060
 16 Unknown_Attribute       0x0022   008   192   000    Old_age   Always       -       154662362454
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       489
193 Load_Cycle_Count        0x0032   192   192   000    Old_age   Always       -       25622
194 Temperature_Celsius     0x0022   121   116   000    Old_age   Always       -       31
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      3239         -
# 2  Short offline       Completed without error       00%      3219         -
# 3  Short offline       Completed without error       00%      3162         -
# 4  Short offline       Completed without error       00%      3124         -
# 5  Short offline       Completed without error       00%      3104         -
# 6  Short offline       Completed without error       00%      3099         -
# 7  Short offline       Completed without error       00%      3098         -
# 8  Short offline       Completed without error       00%      3082         -
# 9  Short offline       Completed without error       00%      3062         -
#10  Short offline       Completed without error       00%      3056         -
#11  Short offline       Completed without error       00%      3046         -
#12  Short offline       Completed without error       00%      3037         -
#13  Short offline       Completed without error       00%      3034         -
#14  Short offline       Completed without error       00%      2994         -
#15  Short offline       Completed without error       00%      2983         -
#16  Short offline       Completed without error       00%      2979         -
#17  Short offline       Completed without error       00%      2966         -
#18  Short offline       Completed without error       00%      2954         -
#19  Short offline       Completed without error       00%      2941         -
#20  Short offline       Completed without error       00%      2938         -
#21  Short offline       Completed without error       00%      2929         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

There is no error of the disc displayed.

magnetic disk or mechanical disk.
The moment any such magnetic/mechanical disk has current, the platter/platters will start spinning. The entire comb (platter and arm) will work together for r&w data. Some models are more loud than others. If S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology; often written as SMART ) is enabled, then it will apear as if the system is working with the disk. So yeah, that is

2 Likes

:point_up_2: TIL :point_up_2:
Thanks!

I am asking, because I had a virus on my USB magnetical disc.
I had to put this disc in the trash can.

In the first MB on this disc, the virus was written and could not be removed, even with formatting the disc.

A side note: just before you mount the device, follow the journal to see any messages realtime, via journalctl -f and/or use iotop. I was curious if anyone would ask about desktop and/or format type…

If you mean on MBR then you not only format the disk, but you create a new partition table, and you do not make it MBR but GPT and you write ZERO’s on it a couple of times if the first time is not working…

1 Like

I have deleted the partition and then I have created a new 2 TB partition on the 2 TB USB mag. disc

  • GPT partition table.

I performed this 2 or 3 times.

The impact of the virus was a slowdown of the data transfer of ~50 %.

Journalctl -f shows nothing exceptional, when mounting the mag. disc.

How can I install iotop ?

pamac install iotop

I don’t think anything on the first sectors of a mechanical/magnetic/spinning disk
will survive a few seconds of
cat /dev/zero > /dev/sdx
followed by sync
or a few seconds of
dd if=/dev/zero of=/dev/sdx
followed by sync

optional bs= and count= parameters
or even until the whole device is overwritten

Have used both to prepare for partitioning by wiping out anything that was present, to write iso images, to back up and write back the MBR …

1 Like

iotop

reports ext4lazyinit, when mouting the 4 TB mag. disc.
It takes ~15 seconds to initialize the disc.

1 Like

Quick question: did you specify lazy_itable_init=0 and/or lazy_journal_init=0 options during partition formatting?

Because, according to this, it seems so:

https://www.thomas-krenn.com/en/wiki/Ext4_Filesystem#Lazy_Initialization

So, in your case, it seems yes, it is normal to have that much activity when it’s mounted.

I have no special options specified during formatting.

No lazy_itable_init=0 or anything else.