📄 mountfs.html
字号:
<HTML><HEAD><TITLE>Creating the mountfs 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 loadkeys script"HREF="../chapter07/loadkeys.html"><LINKREL="NEXT"TITLE="Creating the reboot script"HREF="../chapter07/reboot.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/loadkeys.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/reboot.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="sect1"><H1CLASS="sect1"><ANAME="ch07-mountfs">7.10. Creating the mountfs script</A></H1><P>Create the <TTCLASS="filename">/etc/init.d/mountfs</TT> script by runningthe following command:</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>cat > /etc/init.d/mountfs << "EOF"</B></TT>#!/bin/sh# Begin /etc/init.d/mountfs## Include the functions declared in the /etc/init.d/functions file#source /etc/init.d/functionscase "$1" in start) # # Remount the root partition in read-write mode. -n tells mount # not to # write to the /etc/mtab file (because it can't do this. The # root # partition is most likely still mounted in read-only mode # echo -n "Remounting root file system in read-write mode..." /bin/mount -n -o remount,rw / evaluate_retval # # First empty the /etc/mtab file. Then remount root partition # in read-write # mode again but pass -f to mount. This way mount does # everything # except the mount itself. This is needed for it to write to the # mtab # file which contains a list of currently mounted file systems. # echo > /etc/mtab /bin/mount -f -o remount,rw / # # Remove the possible /fastboot and /forcefsck files. they are # only # supposed to be used during the next reboot's checkfs which just # happened. If you want to fastboot or forcefsck again you'll # have to # recreate the files # /bin/rm -f /fastboot /forcefsck # # Walk through /etc/fstab and mount all file systems that don't # have the noauto option set in the fs_mntops field (the 4th # field. # See man fstab for more info) # echo -n "Mounting other file systems..." /bin/mount -a evaluate_retval ;; stop) # # Deactivate all the swap partitions # echo -n "Deactivating swap..." /sbin/swapoff -a evaluate_retval # # And unmount all the file systems, mounting the root file # system # read-only (all are unmounted but because root can't be # unmounted # at this point mount will automatically mount it read-only # which # is what supposed to happen. This way no data can be written # anymore from disk) # echo -n "Unmounting file systems..." /bin/umount -a -r evaluate_retval ;; *) echo "Usage: $0 {start|stop}" exit 1 ;;esac# End /etc/init.d/mountfs<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/loadkeys.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="../chapter07/reboot.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Creating the loadkeys script</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../chapter07/chapter07.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Creating the reboot script</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -