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

If none of the more specific forums is the right place to ask

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

Postby vitaliok78 » 2018-08-19 16:48

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.
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby milomak » 2018-08-19 17:33

are you asking about this?
iMac Late-2015 27" 5K Retina - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1806
Joined: 2009-06-09 22:20

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

Postby vitaliok78 » 2018-08-19 18:30

milomak wrote:are you asking about this?


Yes, but I want the Debian to execute fsck -p -y -v /dev/sda* on every boot.
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby milomak » 2018-08-19 20:00

what is it that you think is not happening?

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

post your /etc/fstab as well
iMac Late-2015 27" 5K Retina - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1806
Joined: 2009-06-09 22:20

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

Postby vitaliok78 » 2018-08-19 20:06

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*
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby GarryRicketson » 2018-08-19 22:18

According to the manual page there is no -p option:
https://manpages.debian.org/stretch/util-linux/fsck.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/systemd/systemd-fsck.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/e2fsprogs/fsck.ext4.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.
User avatar
GarryRicketson
 
Posts: 5162
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

Postby vitaliok78 » 2018-08-20 08:06

GarryRicketson wrote:According to the manual page there is no -p option:
https://manpages.debian.org/stretch/util-linux/fsck.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/systemd/systemd-fsck.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/e2fsprogs/fsck.ext4.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!
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby p.H » 2018-08-20 09:14

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.
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

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

Postby vitaliok78 » 2018-08-20 09:20

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.)
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby p.H » 2018-08-20 10:51

Irrelevant. fsck does not care.
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

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

Postby vitaliok78 » 2018-08-20 11:37

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?
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby GarryRicketson » 2018-08-20 13:17

From=https://www.cyberciti.biz/faq/linux-force-fsck-on-the-next-reboot-or-boot-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/systemd/man/systemd-fsck@.service.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-fsck-or-e2fsck-when-linux-file-system-is-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.
User avatar
GarryRicketson
 
Posts: 5162
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

Postby vitaliok78 » 2018-08-20 13:59

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!
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26

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

Postby GarryRicketson » 2018-08-20 16:22

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.
User avatar
GarryRicketson
 
Posts: 5162
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

Postby vitaliok78 » 2018-08-20 17:06

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!
vitaliok78
 
Posts: 18
Joined: 2018-08-19 16:26


Return to General Questions

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable