环境组合:
centos7.5
e2fsck version: 1.4.29
resize2fs version:1.4.29
rc.local执行脚本需要扩展LVM空间脚本。 有以下两个句子。
/sbin/e2fsck -f /dev/vg/data
/sbin/resize2fs /dev/vg/data
在启动运行中打印信息,得知错误的原因是在执行e2fsck时发生了错误。
e2fsck : needterminalforinterfactiverepairs
resize2fs将无法运行
解决问题的方法:
1、修正/sbin/e2fsck -f /dev/vg/data为/sbin/e2fsck -fp /dev/vg/data
manpage的p参数的说明如下所示。
-pautomaticallyrepair('preen ) )。 the file system.thisoptionwillcausee2fscktoautomaticallyfixanyfilesystemproblemsthatcanbesafelyfixedwithoumanintervention. fsckdiscoversaproblemwhichmayrequirethesystemadministratotakeadditionalcorrectiveaction、 E2fsckwillprintadescriptionoftheproblemandthenexitwithevalue4logically or ' edintotheexitcode.(seetheeeexitcodesection.) thisoptionisnormallyusedbythesystem ' s boot scripts.itmaynotbespecifiedatthesametimeasthe-nor-y options。
2、挂载/dev/vg/data,然后运行/sbin/resize2fs /dev/vg/data。 /sbin/e2fsck -f /dev/vg/data执行失败不影响resize2fs