I’ve been doing some maintenance on my machines and I’ve been running fsck from the linux side and chkdsk from Windows side.
It seems that with LEAP 15.1 the following methods work:
sudo touch /forcefsck
or
sudo shutdown -fF now
The former seems to run fsck to my / and /home and according to journal, there is a complaint suggesting that I should use the kernel command line and the latter seems to not invoke any complaints but only runs fsck for my /
Honestly, running it from rescue media is probably the cleanest way but I’m wondering what may be the proper procedure on forcing it on boot, and to perform repairs. In my particular case, I’m still using ext4.
Documentations says: Note that in many cases, you don’t want to run fsck. Btrfs is fairly self healing, but when needed check and recovery can be done several ways: FAQ - btrfs Wiki
For “ext4”, I rarely use “fsck”. It is automatically run during startup if needed. If it was properly shutdown, then a “clean” flag is set, and “fsck” on startup just checks the clean flag and normally doesn’t do more. It it was not properly shutdown, then “fsck” is run.
The main time that I manually run “fsck” is because (1) I suspect that it might not have been cleanly shutdown and (2) I want to find out if it was cleanly shutdown before the automatic “fsck” removes the evidence.
I may have missed it, but why do you want to do an fsck in the first place?
Remember that it will be done on boot when the system thinks it is needed. The cause then is probably a failing disk, or a power cut-off that left the file system corrupted. When that fsck needs manual intervention because the obvious way to repair things using the redundant information on the file system fails, booting stops and will advice you to do a manual fsck.
That manual fsck may then ask you for decisions where most people can only answer to with an intelligent guess. In any case, when you are in such a situation, a recover procedure (depending on what is on the partition, a re-install and/or restore from backups) might be a quicker solution. Of course after you have checked that your disk is still OK hardware wise.
IMHO you must have a very strong reason to do an fsck, else do not touch it.
I have several machines which have some form of Windows 10 + LEAP/TW dual+ boot, most of them share a dedicated storage NTFS partition between operating systems and some of them go through some sort of failure throughout usage (most frequently the data drive on my entertainment computer NTFS and EXT4 goes down).
On my more sensitive machines I tend to perform maintenance regularly mostly because I’ve had system failure just at the wrong time.
Recently I have a suspicion that I got a botched SSD on my sensitive machine and I decided to check with both chkdsk (Windows 10) and fsck but I guess it’s redundant and pointless considering that It’s apparently done on every boot according to journalctl.
I do not get all of that, but when you think you have problems with NTFS file systems, you better repair them with Windows. And Windows will never touch your ext4 file systems, thus there is no need to fsck them.
I think to simplify, typically one HDD has 2 NTFS partitions and 1 EXT4 partition. NTFS partitions, I maintain them using chkdsk on Windows. For the EXT4 partition I wanted to force fsck on boot to test and repair.
This drive that has the NTFS+EXT4 partitions has highest failure rate and I want to regularly test and repair bad sectors.
Hello malcolmlewis,
This is a “property” of cheap Seagate Barracuda, after a long write operation the whole computer becomes sluggish and slows down and sometimes crashes. If there is a crash, bad sectors have to be repaired. I am basically on the last 100 GB of a 2TB drive. This is simply how it is for my Barracuda and Firecuda (3 of my firecudas died and they were all replaced with barracuda at the cost of suppliers). I will replace them whence they die but this is also a regular thing to be done on cheap drives.
I file system is a rather complcated structure with many links forward and backward of used and free blocks. When there is a failure in these structures, you can try to repair that with fsck, that will use redundant information to repair the chains. The result will be either a fully operational fs, but the result can also be a partly repaired fs with e.g. files found of which the original place in the directory structure is lost (they will be put in the lost+found directory on some types of file systems). But all these actions are based on fully functional hardware underneath. When you have broken sectors on the disk, you can not repair that with fsck (or whatever recover procedure).
The only thing to do is backup as much as possible (assuming you do a regular backup, that may only be a few last extra saves of some files) and go for another disk. You could of course try to format the broken disk (I mean REAL, often call “low evel” formatting, not the creation of a file system) to mark the broken sectors as such and then use that disk anew. But from the software viewpoint that is the same as another disk.
Henk, the point for me is to let chkdsk/fsck to flag bad sectors and I lose capacity. I don’t expect “recovery” of storage capacity or data (my bad choice of words when I wrote ‘repair’). It’s just a propertly of a cheap drive and especially the last 100GB of the 2TB is pretty bad.
I doubt fsck flags bad sectors. It will present an I/O error like every other program that tries to write/read and gets a failure reported back from the kernel.
It will also only read those data blocks (thus sectors) it needs to check if the fs is OK. If there is no problem in the fs itself it will probably read only a minor subset of all the blocks (and thus sectors) of the file system. Thus it is not a good tool for detecting hardware errors on the disk
There are disk checking programs for that, like badblocks and smartctl. And those will check the whole disk, including a partition table (when available), partitions with file systems (when available), swap partitions (when available), in short any partitions regardless what they may be used for and any other space at all on the disk. In short, it does ignore any usage the disk might have, it just tests the disk from begin to end.
Yes, I have ben using the disk diagnostic tool and bad sector maanger provided by my laptops’ maunfacturer. I was also wondering if fsck can do any good, but I guess not. For for the sake of curiosity, I want to still know how we can run force fsck on boot with “recover” flags.