⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkfs.html

📁 lfs3.1 从源代码构建linux。html版本。
💻 HTML
字号:
<HTML><HEAD><TITLE>Creating the checkfs script</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.63"><LINKREL="HOME"TITLE="Linux From Scratch"HREF="../index.html"><LINKREL="UP"TITLE="Creating system boot scripts"HREF="../chapter07/chapter07.html"><LINKREL="PREVIOUS"TITLE="Creating the functions script"HREF="../chapter07/functions.html"><LINKREL="NEXT"TITLE="Creating the halt script"HREF="../chapter07/halt.html"></HEAD><BODYCLASS="sect1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Linux From Scratch: Version 3.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="../chapter07/functions.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 7. Creating system boot scripts</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="../chapter07/halt.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="sect1"><H1CLASS="sect1"><ANAME="ch07-checkfs">7.7. Creating the checkfs script</A></H1><P>Create the <TTCLASS="filename">/etc/init.d/checkfs</TT> script by runningthe following command:</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>cat &#62; /etc/init.d/checkfs &#60;&#60; "EOF"</B></TT>#!/bin/sh# Begin /etc/init.d/checkfs## Include the functions declared in the /etc/init.d/functions file#source /etc/init.d/functions## Activate all the swap partitions declared in the /etc/fstab file#echo -n "Activating swap..."/sbin/swapon -aevaluate_retval## If the /fastboot file exists we don't want to run the partition checks#if [ -f /fastboot ]then        echo "Fast boot, no file system check"else## Mount the root partition read-only (just in case the kernel mounts it# read-write and we don't want to run fsck on a read-write mounted # partition).#        /bin/mount -n -o remount,ro /        if [ $? = 0 ]        then## If the /forcefsck file exists we want to force a partition check even # if the partition was unmounted cleanly the last time#                if [ -f /forcefsck ]                then                        echo -n "/forcefsck exists, forcing "                        echo "file system check"                        force="-f"                else                        force=""                fi## Check all the file systems mentioned in /etc/fstab that have the# fs_passno value set to 1 or 2 (the 6th field. See man fstab for more# info)#                echo "Checking file systems..."                /sbin/fsck $force -a -A -C -T## If something went wrong during the checks of one of the partitions,# fsck will exit with a return value greater than 1. If this is# the case we start sulogin so you can repair the damage manually#                if [ $? -gt 1 ]                then                        $FAILURE                        echo                        echo -n "fsck failed. Please repair your file "                        echo "systems manually by running /sbin/fsck"                        echo "without the -a option"                        echo                        echo -n "Please note that the root file system "                         echo "is currently mounted in read-only mode."                        echo                        echo -n "I will start sulogin now. When you  "                        echo "logout I will reboot your system."                        echo                        $NORMAL                        /sbin/sulogin                        /sbin/reboot -f                else                        print_status success                fi        else## If the remount to read-only mode didn't work abort the fsck and print# an error#                echo -n "Cannot check root file system because it "                echo "could not be mounted in read-only mode."        fifi# End /etc/init.d/checkfs<TTCLASS="userinput"><B>EOF</B></TT></PRE></FONT></TD></TR></TABLE></P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="../chapter07/functions.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="../chapter07/halt.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Creating the functions script</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../chapter07/chapter07.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Creating the halt script</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -