El 7/10/25 a las 17:37, Dale escribió:
The option no_optimize_extents or even fixes_only should make this questions go away even in /etc/e2fsck.conf, I would not use -y option, -n instead to answer all no. Also you can use -z undo_file to allow restoring if fsck makes one mistakeJavier Martinez wrote:El 7/10/25 a las 16:04, Dale escribió:Howdy,As most everyone knows, I have some large file systems here. Mostly videos. These are encrypted until I open/unlock them. So, when I am on those rare occasions booting up, there's no way to run fsck on them automatically. I basically have two questions on this. 1: How often should I open but not mount the file system and run fsck on it? Once a month, two months, six months, a year or what. 2: Also, what is a command that you use that will fix most things without asking a lot of questions but not do anything that will damage or potentially damage a file? Basically, what command would you use for a situation like this? The man page shows a option for all 'yes' but there may be times when 'yes' isn't a good idea. I'm wondering if someone has came up with a way to handle this with some option I'm not aware of. Right now I use the command e2fsck -pf /dev/mapper/<mount point here> to check it but it ignores some things that it would usually fix if I were being asked first. Something about things could be smaller. It's usually a LOT of them. I'd like those to be corrected as well. Maybe running the check twice with different options will fix it all???? Current info. FILESYSTEM (=) USED FREE (-) %USED USED AVAILABLE TOTAL MOUNTED ON /dev/mapper/crypt [==========================================--------] 83.8% 39.5T 7.6T 47.1T /home/dale/Desktop/Crypt /dev/mapper/data [==============================================----] 91.7% 43.2T 3.9T 47.1T /home/dale/Desktop/Data I'm thinking about adding a 18 or 20TB drive to data. I got a empty one in my safe as a spare. May need to buy a couple more drives soon. Thanks. Dale :-) :-)You can make one script involving cryptsetup and fsck. Or you can add one passfile to the luks volume add it to the crypttab and to the fstab to auto unlock at booting and check it. I suggest you that you make the check every time you are going to mount your disk before doing it. If the filesystem has some kind of error could be problematic. If its in healthy state, it will not spend time, Maybe you can use "-E no_optimize_extents" option in e2fsck if the message that is boring you is related with extents optimization.I had actually thought about including the check in my open script. It's the little script I made to open and mount the file system. I don't want to use anything that opens the file systems automatically. I open and close them manually as needed. The one I get the most is something like this. Inode 761564625 extent tree (at level 1) could be shorter. Optimize? yes Sometimes it says narrower instead of shorter. There are hundreds of them but after a few, it gives me a "a" option to say 'yes to all' of those types of questions. The thing I don't like about the -p option, it seems to only run certain tests but also ignores some things that it might be best to correct as well. When I leave off the -p option, it takes longer but it does more testing. Tests it doesn't do with the -p option. I want it to be thorough in the testing but I also would like it to fix what it can without me typing in "y" for each one, or quite a few of them before giving me a yes to all option. I figure someone on this list has ran into this problem and found a really good solution. I'm just hoping someone will share. LOL ;-) Dale :-) :-)
I suggest you that you use -ck periodically in case that your harddisk start having faulty sectors. You can use tune2fs -c flag to force a check between mounts or use -i to force a complete check between periods of time
So, in resume, always make a fsck check before mount to see if its in a clean state or not.
Use tune2fs to force a check periodically between mounts or time passed even if it seems clean.
If you don't want to take care of extents optimizations, you can set options sent before in /etc/e2fsck.conf
I would never use "-y" option in fsck.If you want to get fsck into the script you should check fsck error codes before mounting the volume, so $? is your friend.
0 - No errors
1 - File system errors corrected
2 - File system errors corrected, system should
be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - E2fsck canceled by user request
128 - Shared library error
If not 0 or 1 don't try to mount it.
OpenPGP_0x57E64E0B7FC3BEDF.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature

