Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

(solved) Forcing Debian 9 to make automatic full LVM disk sc

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

(solved) Forcing Debian 9 to make automatic full LVM disk sc

#1 Post by vitaliok78 »

How to force Debian 9 Linux to make forced automatic LVM disc scan with automatic LVM disk repair on boot?
Last edited by vitaliok78 on 2018-08-20 16:46, edited 2 times in total.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: Forcing Debian 9 to make automatic full LVM disk scan

#2 Post by milomak »

are you asking about this?
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#3 Post by vitaliok78 »

milomak wrote:are you asking about this?
Yes, but I want the Debian to execute fsck -p -y -v /dev/sda* on every boot.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: Forcing Debian 9 to make automatic full LVM disk scan

#4 Post by milomak »

what is it that you think is not happening?

for instance this happens - /etc/init.d/checkfs.sh

post your /etc/fstab as well
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#5 Post by vitaliok78 »

milomak wrote:what is it that you think is not happening?

for instance this happens - /etc/init.d/checkfs.sh

post your /etc/fstab as well
Actually my Debian 9 Linux does not automatically repair the filesystem, it just scan without any fix of the filesystem.

What exact command I do need to write in /etc/init.d/checkfs.sh? I meant: fsck -p -y -v /dev/sda*

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Forcing Debian 9 to make automatic full LVM disk scan

#6 Post by GarryRicketson »

According to the manual page there is no -p option:
https://manpages.debian.org/stretch/uti ... .8.en.html
There is a -P (upper case) option, but are you sure you want that ? It requires
the -A option as well.
-P
When the -A flag is set, check the root filesystem in parallel with the other filesystems. This is not the safest thing in the world to do, since if the root filesystem is in doubt things like the e2fsck(8) executable might be corrupted! This option is mainly provided for those sysadmins who don't want to repartition the root filesystem to be small and compact (which is really the right solution).
What exact command I do need to write in /etc/init.d/checkfs.sh? I meant: fsck -p -y -v /dev/sda*
I am not sure on this, because it is not clear to me what you are trying to do,
Actually my Debian 9 Linux does not automatically repair the filesystem, it just scan without any fix of the filesystem.
What makes you think there is something that needs fixing ?
Also, maybe read: https://manpages.debian.org/stretch/sys ... .8.en.html
KERNEL COMMAND LINE¶
systemd-fsck understands one kernel command line parameter:
fsck.mode=
One of "auto", "force", "skip". Controls the mode of operation. The default is "auto", and ensures that file system checks are done when the file system checker deems them necessary. "force" unconditionally results in full file system checks. "skip" skips any file system checks.
fsck.repair=
One of "preen", "yes", "no". Controls the mode of operation. The default is " preen", and will automatically repair problems that can be safely fixed. "yes " will answer yes to all questions by fsck and "no" will answer no to all questions.
by milomak » post your /etc/fstab as well
Please do this, as requested,..

====== edited====
If you happen to be using 'e2fsck' :
https://manpages.debian.org/stretch/e2f ... .8.en.html
It does have a -p option, but should not be used with the -n or -y options,..
-p
Automatically repair ("preen") the file system. This option will cause e2fsck to automatically fix any filesystem problems that can be safely fixed without human intervention. If e2fsck discovers a problem which may require the system administrator to take additional corrective action, e2fsck will print a description of the problem and then exit with the value 4 logically or'ed into the exit code. (See the EXIT CODE section.) This option is normally used by the system's boot scripts. It may not be specified at the same time as the -n or -y options.

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#7 Post by vitaliok78 »

GarryRicketson wrote:According to the manual page there is no -p option:
https://manpages.debian.org/stretch/uti ... .8.en.html
There is a -P (upper case) option, but are you sure you want that ? It requires
the -A option as well.
-P
When the -A flag is set, check the root filesystem in parallel with the other filesystems. This is not the safest thing in the world to do, since if the root filesystem is in doubt things like the e2fsck(8) executable might be corrupted! This option is mainly provided for those sysadmins who don't want to repartition the root filesystem to be small and compact (which is really the right solution).
What exact command I do need to write in /etc/init.d/checkfs.sh? I meant: fsck -p -y -v /dev/sda*
I am not sure on this, because it is not clear to me what you are trying to do,
Actually my Debian 9 Linux does not automatically repair the filesystem, it just scan without any fix of the filesystem.
What makes you think there is something that needs fixing ?
Also, maybe read: https://manpages.debian.org/stretch/sys ... .8.en.html
KERNEL COMMAND LINE¶
systemd-fsck understands one kernel command line parameter:
fsck.mode=
One of "auto", "force", "skip". Controls the mode of operation. The default is "auto", and ensures that file system checks are done when the file system checker deems them necessary. "force" unconditionally results in full file system checks. "skip" skips any file system checks.
fsck.repair=
One of "preen", "yes", "no". Controls the mode of operation. The default is " preen", and will automatically repair problems that can be safely fixed. "yes " will answer yes to all questions by fsck and "no" will answer no to all questions.
by milomak » post your /etc/fstab as well
Please do this, as requested,..

====== edited====
If you happen to be using 'e2fsck' :
https://manpages.debian.org/stretch/e2f ... .8.en.html
It does have a -p option, but should not be used with the -n or -y options,..
-p
Automatically repair ("preen") the file system. This option will cause e2fsck to automatically fix any filesystem problems that can be safely fixed without human intervention. If e2fsck discovers a problem which may require the system administrator to take additional corrective action, e2fsck will print a description of the problem and then exit with the value 4 logically or'ed into the exit code. (See the EXIT CODE section.) This option is normally used by the system's boot scripts. It may not be specified at the same time as the -n or -y options.
Yes! I do want e2fsck to automatically repair the file-system ( /boot, /, /home/ /var/ on without any prompt from my side on Debian 9 Linux boot!

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Forcing Debian 9 to make automatic full LVM disk scan

#8 Post by p.H »

vitaliok78 wrote:I want the Debian to execute fsck -p -y -v /dev/sda* on every boot.
This has nothing to do with LVM disk scan. Please correct the subject.

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#9 Post by vitaliok78 »

p.H wrote:
vitaliok78 wrote:I want the Debian to execute fsck -p -y -v /dev/sda* on every boot.
This has nothing to do with LVM disk scan. Please correct the subject.
I installed the Debian 9 Linux with LVM ( separated /boot /home /var /tmp.)

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Forcing Debian 9 to make automatic full LVM disk scan

#10 Post by p.H »

Irrelevant. fsck does not care.

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#11 Post by vitaliok78 »

p.H wrote:Irrelevant. fsck does not care.
Then where exactly and what exactly should I execute ( input or print ) in order e2fsck to make full automatic entire all disk repair on boot without my hand intervention?

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Forcing Debian 9 to make automatic full LVM disk scan

#12 Post by GarryRicketson »

From=https://www.cyberciti.biz/faq/linux-for ... -sequence/
A note about systemd based systems

The above mentioned solution only works with the old SysVinit and early versions of Upstart. It won’t work with systemd. systemd-fsck understands one kernel command line parameter:

fsck.mode=
One of “auto”, “force”, “skip”. Controls the mode of operation. The default is “auto”, and ensures that file system checks are done when the file system checker deems them necessary. “force” unconditionally results in full file system checks. “skip” skips any file system checks.

fsck.repair=
One of “preen”, “yes”, “no”. Controls the mode of operation. The default is ” preen”, and will automatically repair problems that can be safely fixed. “yes ” will answer yes to all questions by fsck and “no” will answer no to all questions.
====
Important : https://www.freedesktop.org/software/sy ... rvice.html
The default is "preen", and will automatically repair problems that can be safely fixed. "yes" will answer yes to all questions by fsck and "no" will answer no to all questions.
I can not help much, because I am not using any systemd system, how ever on both of my systems, Debian 7 and OpenBsd, this is all done automatically,..
Something to keep in mind: will automatically repair problems that can be safely fixed.
This does not mean that everything will definitely be fixed or repaired, some times there may be files it is not able to repair, in which case you would still need to run fsck manually, and try to repair the specific files.
These services are started at boot if passno in /etc/fstab for the file system is set to a value greater than zero.
2 times now , we have asked you to show your:

Code: Select all

/etc/fstab 
file,
by milomak » post your /etc/fstab as well
and then I asked again .
Your refusal to do this, leads me to believe it is pointless to even try to help any further,... the value should be 1, if you want it to do this on every boot.
On both of my systems, the default runs a check every boot, I am not sure on debian 9 with systemd, but reading the manuals gives me the impression the same, it is all ready set by default to run the checks, and try to repair any files it can. So , unless you have been messing around, and changing the defaults,
it should be checking and repairing any files it can. If you have made changes to the defaults, then you need to show us exactly what you have done, and show us the files requested,..
Actually my Debian 9 Linux does not automatically repair the filesystem
Which file system specifically ? Again, what makes you think this file system is even broken or "dirty", it may be it can not repair it, so you would have to try manually, and if you are unable to do it manually, replace the file system with a new, clean file system.
Do you have a specific file system that is broken and needs repair ?
If nothing is broken, then there is nothing to do, e2fsck, or fsck, nor anything else will repair something that is not broken.
==== edited ====
One last note, if you do have broken file system/systems, the repairs should not be done "automatically" on a mounted drive, more details here:
https://www.cyberciti.biz/faq/can-i-run ... s-mounted/
No. Do not run fsck on a live or mounted file system. fsck is used to check and optionally repair one or more Linux file systems. Running fsck on a mounted filesystem can usually result in disk / data corruption. So please do not do it. You have two choices
(a) Take down system to single user mode and unmout system
(b) Boot from the installation CD into rescue mode
Please take the time to read all of it, I only quoted part. Sometimes there are things that can only be done manually, and must be done manually. Sorry to say that, but it is reality.

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#13 Post by vitaliok78 »

milomak wrote:what is it that you think is not happening?

for instance this happens - /etc/init.d/checkfs.sh

post your /etc/fstab as well
I tried those solutions below:

1) apt-get install initscripts
2) Changed FSCFIX from No to Yes in the /etc/init.d/checkfs.sh
3) ./shutdown -r now
4) Errors fixed.
5) My Debian 9 Linux boots normally without any errors and speeded up the booting process.

My CONGRATULATIONS for myself!

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Forcing Debian 9 to make automatic full LVM disk scan

#14 Post by GarryRicketson »

Thank you milomak for pointing this out earlier in the thread.
milomak wrote:what is it that you think is not happening?

for instance this happens - /etc/init.d/checkfs.sh

post your /etc/fstab as well
Well congratulations, you figured it out, please take the time to edit your first post, add the word solved to the subject line:
example:

Code: Select all

(soleved)Forcing Debian 9 to make automatic full LVM disk scan 
Last edited by GarryRicketson on 2018-08-20 17:09, edited 1 time in total.

vitaliok78
Posts: 18
Joined: 2018-08-19 16:26

Re: Forcing Debian 9 to make automatic full LVM disk scan

#15 Post by vitaliok78 »

GarryRicketson wrote:
milomak wrote:what is it that you think is not happening?

for instance this happens - /etc/init.d/checkfs.sh

post your /etc/fstab as well
Well congratulations, you figured it out, please take the time to edit your first post, add the word solved to the subject line:
example:

Code: Select all

(soleved)Forcing Debian 9 to make automatic full LVM disk scan 
My further offered two solutions for other Debian Linux users who struggles with repairing the Linux filesystem and wants automatic repair of the Linux filesystem are bellow:

1) sudo apt-get install initscripts
2) Change the FSCKFIX option from No to Yes in /etc/init.d/checkfs.ch
3) sudo shutdown -r now
4) The filesystem is being automatically repaired while booting the Debian Linux.
5) The Debian Linux will boot correctly ( if a service fails to run, check that failed service error log, suppose the error log is located in the /var/log/).
6) Keep all important files in the /home and not /var directory!
7) Use /var for MySQL or other database type and emails ( if a Debian Linux server is deployed ).
8) Use incrimental backup of /home and /var ( if a Debian Linux server is deployed ) once a day somewhere else like USB Stick or on a USB HDD!

1) Boot from the Debian Linux installation CD and choose the Emergency Mode or Repair Mode.
2) Execute the command: e2fsck -p -f /dev/sdaX or e2fsck -p -f /dev/sdbX.
3) Reboot the Debian Linux from the HDD.
Note: X is the device number like: 1 or 2 or 5.

Enjoy your Debian Linux!

Post Reply