Weekly Shaarli
Week 13 (March 29, 2021)
Check SMART available and enabled:
# smartctl --health --info /dev/sda
...
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Test duration:
# smartctl --capabilities /dev/sda
...
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 313) minutes.
Short test:
# smartctl --test short /dev/sda
*sleep 2 minutes*
# smartctl --log selftest /dev/sda
Exemple results:
=== START OF READ SMART DATA SECTION ===
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% 3224 -
Long test:
# smartctl --test long /dev/sda
*sleep 313 minutes*
# smartctl --log selftest /dev/sda
Pour Windows:
CHKDSK F: /f /r
/f fixes any structural issues with the file system and directory, correcting inconsistencies between the two
/r searches for and fixes corrupted parts of the hard drive (while also running chkdsk /f). Sometimes it can’t fix the unusable or damaged sectors that it finds.
FSCK
fsck -fvn /dev/sdX # dry run
fsck -fvy /dev/sdX # applyBon, pour les printfs en C:
#include <inttypes.h>
#define PRIu8 "hu"
#define PRId8 "hd"
#define PRIx8 "hx"
#define PRIu16 "hu"
#define PRId16 "hd"
#define PRIx16 "hx"
#define PRIu32 "u"
#define PRId32 "d"
#define PRIx32 "x" // x -> number in hexadecimal
#define PRIu64 "llu" // or possibly "lu"
#define PRId64 "lld" // or possibly "ld"
#define PRIx64 "llx" // or possibly "lx"
| Syntax | Description |
|---|---|
| %zu | size_t |
| %d / %i | int |
| %u | unsigned int |
| %ld | long |
| %lu | unsigned long |
| %lld | long long |
| %llu | unsigned long long |
| %c | character |
| %s | a string of characters |
| %e | exponential floating-point number |
| %f | floating-point number |
| %0.2f | floating-point number (like 0.58) |
| %o | octal number (base 8) |
| %% | print a percent sign |
| \% | print a percent sign |
| - | - |
| %hhn | unsigned char * |
Finalement, pourquoi on ne mets pas toujours PRIxxx, ça serait plus explicite ...