issue208:mon_opinion
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue208:mon_opinion [2024/08/31 14:33] – créée auntiee | issue208:mon_opinion [2024/09/03 16:59] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | One of our readers sent us a letter (FCM#207) stating that you can no longer force fsck on Ubuntu, and honestly, it has been so long since I have used it personally, I thought it may be a good idea to refresh people’s memory regarding fsck. (I did do this recently for my cousin over the phone, but he still uses 18.04). If you are a n00b, you will find this interesting, | + | **One of our readers sent us a letter (FCM#207) stating that you can no longer force fsck on Ubuntu, and honestly, it has been so long since I have used it personally, I thought it may be a good idea to refresh people’s memory regarding fsck. (I did do this recently for my cousin over the phone, but he still uses 18.04). If you are a n00b, you will find this interesting, |
I suggest opening the fsck man page and looking at the exit codes. Mostly you need to know about 0,1,2,4. | I suggest opening the fsck man page and looking at the exit codes. Mostly you need to know about 0,1,2,4. | ||
Ligne 8: | Ligne 8: | ||
or just: | or just: | ||
+ | |||
+ | fsck /dev/sda1** | ||
+ | |||
+ | Un de nos lecteurs nous a envoyé un courriel (le FCM n° 207) qui disait qu’il n’était plus possible de forcer fsck sur Ubuntu et, honnêtement, | ||
+ | |||
+ | Je suggère d’ouvrir la page man fsck et de regarder les codes de sortie. Pour la plupart, vous devrez connaître 0, 1, 2, 4. | ||
+ | |||
+ | Fsck est comme un terme vague car, derrière le rideau, il appelle, disons, fsck.ext4. Pensez-y comme à une famille de commandes où vous pouvez spécifier ce dont vous avez besoin. Par exemple, j’utilise ext4 et je peux donc dire : | ||
+ | |||
+ | fsck.ext4 / | ||
+ | |||
+ | ou tout simplement : | ||
fsck /dev/sda1 | fsck /dev/sda1 | ||
- | Tip: You can see them all by typing: ls -l / | + | |
+ | **Tip: You can see them all by typing: ls -l / | ||
If you come from a Windows background, and most of you do, then think chkdsk. You used to run it with -f now -p (I think; I also have not done it in years). Just keep it in the back of your mind, we will touch on that again. | If you come from a Windows background, and most of you do, then think chkdsk. You used to run it with -f now -p (I think; I also have not done it in years). Just keep it in the back of your mind, we will touch on that again. | ||
Ligne 19: | Ligne 32: | ||
Reminder: do not try to run fsck on mounted drives! | Reminder: do not try to run fsck on mounted drives! | ||
- | For n00bs: to see if your drives are mounted, run lsblk (you can also use df, but lsblk is cleaner). | + | For n00bs: to see if your drives are mounted, run lsblk (you can also use df, but lsblk is cleaner).** |
- | My disk has a mount point, so if I were to try fsck, it will warn me (see below) | + | Astuce : vous pouvez les voir toutes en tapant : ls -l / |
+ | |||
+ | Si vos antécédents comprennent Windows, et c’est le cas de la plupart d’entre vous, pensez à chkdsk. Vous l’avez exécuté avec -f et maintenant avec -p (je pense ; je ne l’ai pas fait depuis des années). Gardez-le à l' | ||
+ | |||
+ | Pour les débutants : | ||
+ | |||
+ | Rappel : n’essayez pas de lancer fsck sur des disques montés ! | ||
+ | |||
+ | Pour les débutants : | ||
+ | |||
+ | |||
+ | **My disk has a mount point, so if I were to try fsck, it will warn me (see below) | ||
As with Windows chkdsk, you can use -p to basically tell fsck to go ahead and automatically fix errors, without you having to click yes to each repair. (I’ll have to check if this is still the case, as it is not listed in the man page.) Prior Windows used chkdsk -f (windows before NT, iirc) to check and fix the drive automatically, | As with Windows chkdsk, you can use -p to basically tell fsck to go ahead and automatically fix errors, without you having to click yes to each repair. (I’ll have to check if this is still the case, as it is not listed in the man page.) Prior Windows used chkdsk -f (windows before NT, iirc) to check and fix the drive automatically, | ||
Ligne 32: | Ligne 56: | ||
• unmount partition with umount | • unmount partition with umount | ||
• confirm with lsblk | • confirm with lsblk | ||
- | • check drive with fsck (you need to be root) | + | • check drive with fsck (you need to be root)** |
- | As you can see from my “exit code” that we talked about, right at the beginning, my drive is fine. | + | Mon disque a un point de montage. Ainsi, si j’essayais fsck, il me préviendrait (voir ci-dessous) |
+ | |||
+ | Comme avec le chkdsk de Windows, vous pouvez utiliser -p pour essentiellement dire à fsck d’y aller et de réparer les erreurs automatiquement sans que vous ayez à cliquer sur oui pour chaque réparation. (Je vais devoir vérifier si c’est toujours le cas, car il n’est pas listé sur la page man.) Les Windows antérieurs utilisaient chkdsk -f (c-à-d Windows avant NT, iirc) pour vérifier et corriger automatiquement le disque, mais, dans Linux, le -f est FORCE ; il faut donc être très prudent quand vous ajoutez une option. Cela force une vérification même si le système de fichiers est dit « clean » (propre). | ||
+ | |||
+ | D’autres options à connaître sont -y, -n, -c : -y étant « yes – oui – à tout », -n étant « non à tout » et -c étant « afficher la barre de complétion ». | ||
+ | |||
+ | Exemple : | ||
+ | (NVME est sur mon portable, mais le processus est le même pour les disques mécaniques) : | ||
+ | 1. listez avec lsblk | ||
+ | 2. démontez la partition avec umount | ||
+ | 3. confirmez avec lsblk | ||
+ | 4. vérifier le disque avec fsck (vous devez être root) | ||
+ | |||
+ | |||
+ | **As you can see from my “exit code” that we talked about, right at the beginning, my drive is fine. | ||
I know my drive is fine, so I expected 0 as an outcome. If you suspect errors on your drive, your desired outcome is 1. If you see 4, you need to worry. | I know my drive is fine, so I expected 0 as an outcome. If you suspect errors on your drive, your desired outcome is 1. If you see 4, you need to worry. | ||
Ligne 44: | Ligne 82: | ||
Another way is to use tune2fs, or I should say the modern way, as forcefsck no longer works in Ubuntu from 20.04 onwards. (I’ll add a link at the end of the article). | Another way is to use tune2fs, or I should say the modern way, as forcefsck no longer works in Ubuntu from 20.04 onwards. (I’ll add a link at the end of the article). | ||
- | The man page for tune2fs is a spaghetti jumble, that no new user should try and traverse, I just had a look and found the skeleton of a user from 2014 still stuck in there. Tune2fs is a great tool, but it is like a Swiss army knife when all we need is a flat head screwdriver. | + | The man page for tune2fs is a spaghetti jumble, that no new user should try and traverse, I just had a look and found the skeleton of a user from 2014 still stuck in there. Tune2fs is a great tool, but it is like a Swiss army knife when all we need is a flat head screwdriver. |
- | If you did look at the man page, the only flag we are interested in is the first one, -c (count how many times a drive is mounted before checking). We are not going to dive in here, as I still have to sleep sometime. Armed with what you now know, you can run a check. | + | Comme vous pouvez le constater grâce au « code de sortie » dont j’ai parlé tout au début, mon disque n'a aucun problème. |
+ | |||
+ | Puisque je sais que le disque n'a aucun problème, je me suis attendu à 0 comme sortie. Si vous soupçonnez des erreurs sur votre disque, la sortie désirée est 1. Si 4 s’affiche, | ||
+ | |||
+ | Le montage de la racine « / » est différent. | ||
+ | |||
+ | Dans des versions antérieures d’Ubuntu, vous pouviez taper : sudo touch /forcefsck et redémarrer. Vous pouviez aussi démarrer en mode récupération et sélectionner l’option fsck. | ||
+ | |||
+ | Une autre façon de faire – ou je devrais dire la façon moderne de faire - est d’utiliser tune2fs, car forcefsck ne fonctionne plus dans Ubuntu depuis la 20.04. (J’ajouterai un lien à la fin de l’article.) | ||
+ | |||
+ | La page man pour tune2fs est un mélange de spaghettis qu’aucun nouvel utilisateur devrait essayer de comprendre – je viens de la regarder et j’y ai trouvé le squelette d’un utilisateur qui y était coincé depuis 2014. Tune2fs est un outil formidable, mais c’est comme un couteau suisse quand tout ce dont nous avons besoin est un tournevis à tête plate. | ||
+ | |||
+ | |||
+ | **If you did look at the man page, the only flag we are interested in is the first one, -c (count how many times a drive is mounted before checking). We are not going to dive in here, as I still have to sleep sometime. Armed with what you now know, you can run a check. | ||
sudo tune2fs -c 1 / | sudo tune2fs -c 1 / | ||
Ligne 64: | Ligne 115: | ||
sudo tune2fs -l / | sudo tune2fs -l / | ||
- | (replace nvme1n1p1 with your drive – if I have to keep posting images, Ronnie will swear at me and you guys are a bright lot...). | + | (replace nvme1n1p1 with your drive – if I have to keep posting images, Ronnie will swear at me and you guys are a bright lot...).** |
- | Bonus: | + | Si vous avez regardé la page man, le seul drapeau qui nous intéresse est le premier, -c (compter le nombre de fois qu’un disque est monté avant de le vérifier). Nous n’allons pas nous lancer dedans, car je dois quand même dormir de temps en temps. Armé de ce que vous savez maintenant, vous pouvez exécuter une vérification. |
+ | |||
+ | sudo tune2fs -c 1 / | ||
+ | (dans mon portable) | ||
+ | |||
+ | sudo tune2fs -c 1 /dev/sda1 | ||
+ | (dans mon vieil ordinateur de bureau) | ||
+ | |||
+ | La recette pour vous est : sudo tune2fs -c 1 / | ||
+ | |||
+ | Redémarrez. | ||
+ | |||
+ | OK, tout est parfait, mais comment vérifier quand le dernier disque a été vérifié ? | ||
+ | |||
+ | sudo tune2fs -l / | ||
+ | |||
+ | (remplacez nvme1n1p1 par votre disque – si je dois insérer d’autres images, Ronnie va me crier dessus et vous, les lecteurs, êtes très intelligents...) | ||
+ | |||
+ | |||
+ | **Bonus: | ||
How to set up regular checks, with the -i flag: (interval) | How to set up regular checks, with the -i flag: (interval) | ||
Ligne 76: | Ligne 146: | ||
Again, thanks to our wonderful readers for pointing out our mistakes, without you we would be Windows (L)users! :) | Again, thanks to our wonderful readers for pointing out our mistakes, without you we would be Windows (L)users! :) | ||
- | Let us know: misc@fullcirclemagazine.org | + | Let us know: misc@fullcirclemagazine.org** |
+ | |||
+ | Bonus : | ||
+ | |||
+ | Comment configurer des vérifications régulières avec le drapeau -i (interval) : | ||
+ | |||
+ | « sudo tune2fs -i 1w / | ||
+ | |||
+ | Voilà. Je pense que c’était bref et succinct. J’espère que nous l’avons simplifié pour vous, sinon, regardez ici : | ||
+ | |||
+ | https:// | ||
+ | |||
+ | À nouveau, remerciements à nos lecteurs fantastiques qui nous signalent nos erreurs ; sans vous, nous serions des utilisateurs de Windows (L) ! :) | ||
+ | |||
+ | Dites-le-nous : misc@fullcirclemagazine.org |
issue208/mon_opinion.1725107600.txt.gz · Dernière modification : 2024/08/31 14:33 de auntiee