logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).

#1 13-08-2020 09:41:46

Debian Alain
Membre
Lieu : Bretagne
Distrib. : sid (unstable) / bullseye (stable)
Noyau : Linux sid 6.4.0-3-amd64
(G)UI : Gnome X.org (X11) / GDM3
Inscription : 11-03-2017
Site Web

[résolu] power on hours nvme

bonjour à tous   big_smile big_smile big_smile

sur mon systeme , j'ai  deux ssd .(+ un hdd pour les sauvegardes (donc assez volumineux))

un en 2.5 pouces (debian stable)  et un en M.2(debian testing , mon disque courant dont je me sers constamment).

mon hdd :

sudo smartctl -a /dev/sdb

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.7.0-2-amd64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Video 3.5 HDD
Device Model:     ST4000VM000-2AF166
Serial Number:    WDH0AFF6
LU WWN Device Id: 5 000c50 09ca2e849
Firmware Version: SC11
User Capacity:    4000787030016 bytes [4,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5980 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Aug 13 10:45:33 2020 CEST
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:    (  591) 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:    (   1) minutes.
Extended self-test routine
recommended polling time:    ( 637) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x50bd) SCT Status supported.
          SCT Error Recovery Control supported.
          SCT Feature Control supported.
          SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   083   064   044    Pre-fail  Always       -       206743925
  3 Spin_Up_Time            0x0003   094   093   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   096   096   020    Old_age   Always       -       4618
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   085   060   045    Pre-fail  Always       -       286607462
  9 Power_On_Hours          0x0032   079   079   000    Old_age   Always       -       18842 (72 228 0)
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   097   097   020    Old_age   Always       -       4083
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   098   000    Old_age   Always       -       55835426834
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   073   056   040    Old_age   Always       -       27 (Min/Max 27/27)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1207
193 Load_Cycle_Count        0x0032   096   096   000    Old_age   Always       -       8006
194 Temperature_Celsius     0x0022   027   044   000    Old_age   Always       -       27 (0 15 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       15579 (231 234 0)
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       24914035486
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       110240584790

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  Conveyance offline  Completed without error       00%     17962         -
# 2  Extended offline    Completed without error       00%     15413         -
# 3  Short offline       Completed without error       00%     13710         -
# 4  Short offline       Completed without error       00%      9496         -

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.



mon ssd sata 2.5 pouces :

smartctl -a /dev/sda

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.7.0-2-amd64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Crucial/Micron BX/MX1/2/3/500, M5/600, 1100 SSDs
Device Model:     CT1000MX500SSD1
Serial Number:    2027E2B2B9E2
LU WWN Device Id: 5 00a075 1e2b2b9e2
Firmware Version: M3CR032
User Capacity:    1000204886016 bytes [1,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.3, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Aug 13 10:19:54 2020 CEST
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:  (0x80) Offline data collection activity
          was never started.
          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:    (    0) 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:    (  30) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x0031) 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   100   100   000    Pre-fail  Always       -       0
  5 Reallocate_NAND_Blk_Cnt 0x0032   100   100   010    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       117
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       69
171 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
173 Ave_Block-Erase_Count   0x0032   100   100   000    Old_age   Always       -       0
174 Unexpect_Power_Loss_Ct  0x0032   100   100   000    Old_age   Always       -       23
180 Unused_Reserve_NAND_Blk 0x0033   000   000   000    Pre-fail  Always       -       30
183 SATA_Interfac_Downshift 0x0032   100   100   000    Old_age   Always       -       0
184 Error_Correction_Count  0x0032   100   100   000    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
194 Temperature_Celsius     0x0022   074   057   000    Old_age   Always       -       26 (Min/Max 0/43)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
202 Percent_Lifetime_Remain 0x0030   100   100   001    Old_age   Offline      -       0
206 Write_Error_Rate        0x000e   100   100   000    Old_age   Always       -       0
210 Success_RAIN_Recov_Cnt  0x0032   100   100   000    Old_age   Always       -       0
246 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       181036230
247 Host_Program_Page_Count 0x0032   100   100   000    Old_age   Always       -       1536040
248 FTL_Program_Page_Count  0x0032   100   100   000    Old_age   Always       -       1385013

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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  Completed [00% left] (0-65535)
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.



mon ssd nvme :

smartctl -a /dev/nvme0n1

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.7.0-2-amd64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       CT1000P1SSD8
Serial Number:                      2006E289B7B7
Firmware Version:                   P3CR013
PCI Vendor/Subsystem ID:            0xc0a9
IEEE OUI Identifier:                0x00a075
Controller ID:                      1
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1000204886016 [1,00 TB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            00a075 20e289b7b7
Local Time is:                      Thu Aug 13 10:21:44 2020 CEST
Firmware Updates (0x14):            2 Slots, no Reset required
Optional Admin Commands (0x0016):   Format Frmw_DL Self_Test
Optional NVM Commands (0x005e):     Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Maximum Data Transfer Size:         32 Pages
Warning  Comp. Temp. Threshold:     70 Celsius
Critical Comp. Temp. Threshold:     80 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W       -        -    0  0  0  0        5       5
 1 +     4.60W       -        -    1  1  1  1       30      30
 2 +     3.80W       -        -    2  2  2  2       30      30
 3 -   0.0500W       -        -    3  3  3  3     1000    1000
 4 -   0.0040W       -        -    4  4  4  4     6000    8000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

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

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        39 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    2143120 [1,09 TB]
Data Units Written:                 5549639 [2,84 TB]
Host Read Commands:                 27981012
Host Write Commands:                112517896
Controller Busy Time:               908
Power Cycles:                       274
Power On Hours:                     1002
Unsafe Shutdowns:                   78
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               40 Celsius
Temperature Sensor 2:               39 Celsius
Temperature Sensor 5:               47 Celsius

Error Information (NVMe Log 0x01, max 256 entries)
No Errors Logged



côté fonctionnement , rien à dire .

par contre , je suis contrarié pour les heures de fonctionnement .scratchhead.gif

je voudrai les  afficher en mois , jours et heures mais j'ai des soucis .
je ne connais pas la bonne commande et , en plus , awk , tout beau qu'il soit , m'est assez  hermétique .

sudo smartctl -a /dev/disk/by-id/ata-ST4000VM000-2AF166_WDH0AFF6 | awk '/Power_On/ { print "Durée : " int($10/720) " mois, " int($10/24) " jours et " $10 % 24 " heures"}'

Durée : 26 mois, 785 jours et 2 heures


résultat intéressant , malheureusement , le nombre de jours n'est pas déduit du nombre de mois : résultat mal fagoté .

sudo smartctl -a /dev/disk/by-id/ata-CT1000MX500SSD1_2027E2B2B9E2 | awk '/Power_On/ { print "Durée : " int($10/720) " mois, " int($10/24) " jours et " $10 % 24 " heures"}'

Durée : 0 mois, 4 jours et 21 heures


intéressant mais quand mon disque aura 1 mois et plus , que se passera t il ?

sudo smartctl -a /dev/nvme0n1 | awk '/Power On Hours:/ { print "Durée : " int($4) " mois, " int($5/24) " jours et " $5 % 24 " heures"}'

Durée : 1 mois, 0 jours et 0 heures


j'ai légèrement retouché la ligne de commande (champs $4 et $5) ,mais , est elle bonne ?

voilà , le but est d'afficher le champ "power on hours" en mois , jours , et heures  pour chacun de mes disques :
- le seagate
- le ssd sata
- le ssd nvme

mais je sais pas faire .

un coup de main ?

merci .

alain.

coyotus.png

p.s. : tenté ceci :

sudo smartctl -a /dev/sdb | awk '/Power_On/ { print "Durée : " int($10/720) " mois, " int($10 % 720) " jours et " $10 % 24 " heures"}'

Durée : 26 mois, 123 jours et 3 heures


mais je suis pas  sûr de moi ...

Dernière modification par Debian Alain (13-08-2020 13:49:15)

Hors ligne

#2 13-08-2020 10:33:03

vv222
Administrateur
Lieu : Bretagne
Distrib. : Debian Sid
(G)UI : sway
Inscription : 18-11-2013
Site Web

Re : [résolu] power on hours nvme

Je pense que le plus compliqué ici c’est que tu ne maîtrises pas awk (moi non plus d’ailleurs) et donc tu n’es pas capable de faire évoluer ce script.

Je partirais pour simplifier ça sur l’écriture de deux scripts distincts :
- un script qui récupère le nombre d’heures de fonctionnement d’un disque
- un script qui convertit un nombre d’heures pour l’afficher dans le format que tu souhaites ("x mois, y jours et z heures")

En isolant les deux tâches, je pense que tu te retrouveras face à deux problèmes abordables plutôt qu’un seul problème hors de ta portée wink

Jouer sous Debian ? Facile !

Ceterum censeo Barum esse delendam

Hors ligne

#3 13-08-2020 11:13:43

Debian Alain
Membre
Lieu : Bretagne
Distrib. : sid (unstable) / bullseye (stable)
Noyau : Linux sid 6.4.0-3-amd64
(G)UI : Gnome X.org (X11) / GDM3
Inscription : 11-03-2017
Site Web

Re : [résolu] power on hours nvme

c'est surtout les opérateurs arithmétiques et logiques qui me font défaut .

je ne sais pas  quels calculs mettre pour obtenir le nombre de mois , les jours restants et les heures restantes .

Hors ligne

#4 13-08-2020 13:25:05

anonyme
Invité

Re : [résolu] power on hours nvme

Bonjour
vv222 te donne une voie
php traite bien heure et date , voir aussi du coté de python
mais bon la démarche me semble lourde , quel intérêt de savoir le nombre d' heure de fonctionnement ?
tu peu lancer un compteur a l' allumage de la machine aussi   tongue
out.gif

#5 13-08-2020 13:44:50

Debian Alain
Membre
Lieu : Bretagne
Distrib. : sid (unstable) / bullseye (stable)
Noyau : Linux sid 6.4.0-3-amd64
(G)UI : Gnome X.org (X11) / GDM3
Inscription : 11-03-2017
Site Web

Re : [résolu] power on hours nvme

trouvé , grâce à captnfab et enikar (sur irc) .

sudo smartctl -a /dev/nvme0n1 | awk '/Power On Hours:/ { sub(/\xe2\x80\xaf/, "", $4);print "Durée : " int($4/720) " mois, " int(($4%720)/24) " jours et " $4 % 24 " heures" }'

Durée : 1 mois, 11 jours et 23 heures

Dernière modification par Debian Alain (13-08-2020 13:46:35)

Hors ligne

Pied de page des forums