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

📄 lsg18.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 4 页
字号:






<BR>







<PRE>







<FONT COLOR="#000080">/dev/sda2 none swap sw 0 0</FONT></PRE>







<P>When you include a swap partition in /etc/fstab, you can activate it using the swapon command. When you execute the command







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">swapon -a</FONT></PRE>







<P>Linux reads the /etc/fstab file and activates all swap partitions. This command is usually embedded in the /etc/rc file (so it is executed automatically when Linux boots), although it can be run from the command line just as easily.







<BR>







<BR>







<A NAME="E69E130"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Filesystem Types</B></FONT></CENTER></H4>







<BR>







<P>The types of filesystems that Linux supports vary depending on the version of Linux you are using. Most versions support the following filesystem types, though. You can use them in the /etc/fstab file:







<BR>















<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







ext2







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the second extended filesystem, which is the most common type of Linux partition.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







ext







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the original Linux extended filesystem, which has been replaced by ext2.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







minix







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the original Minix filesystem, which is rarely used but is still supported because it was the first Linux filesystem format.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







xia







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the Xia filesystem, which is rarely used because it has been superseded by ext2.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







umsdos







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the UMS-DOS filesystem, which is used to install Linux on a DOS partition (with no dedicated Linux partition).</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







proc







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the filesystem based on /proc, which is used for some processes that use system information.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







iso9660







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the ISO 9660 filesystem, which is used on most CD-ROM disks.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







xenix







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the SCO Xenix filesystem, which provides support for Xenix under Linux.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







sysv







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the UNIX System V filesystem, which provides support for System V drives under Linux.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







coherent







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is Mark Williams' Coherent UNIX version, which provides support for Coherent filesystems under Linux.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







msdos







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is a DOS partition that Linux can access.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







hpfs







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This type is the High Performance filesystem, which provides support for HPFS under Linux.</FONT>







</TABLE><P>Some versions of Linux do not include support for all filesystems included above, especially the lesser-used filesystems like coherent and minix. A filesystem called nfs, which supports the Network filesystem, is supported on recent Linux versions. The nfs filesystem refers to Network Filesystem, which is examined later in this book.







<BR>







<BR>







<A NAME="E69E131"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Options Values</B></FONT></CENTER></H4>







<BR>







<P>The options field in the /etc/fstab file can have several different values, depending on the version of Linux. For most versions of Linux (which are based on BSD UNIX), you can use the following options to describe the filesystem characteristics:







<BR>















<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







default







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Varies depending on version, but normally read-write, suid, and quota</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







rw







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Read-write</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







ro







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Read-only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







suid







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Access in SUID mode allowed</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







nosuid







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Access in SUID mode not allowed</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







quota







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Quotas may be in effect</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







noquota







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Quotas may not be in effect</FONT>







</TABLE><P>If the filesystem type is nfs, many more options are supported. The default option tends to be the best choice for typical filesystems mounted on a local hard drive.







<BR>







<BLOCKQUOTE>







<BLOCKQUOTE>







<HR ALIGN=CENTER>







<BR>







<NOTE>You may see the term SUID used often when dealing with system administration. SUID stands for Set User ID and is a permission bit associated with all files and directories. There is also a bit called SGID, for Set Group ID. Any file or directory with these bits set act as though they were owned by another user. For example, you could be logged in as a normal user and execute a binary file that has SUID set. The binary will execute as though it was run by root. Both SUID and SGID are dangerous bits to work with as they can provide security problems.</NOTE>







<BR>







<HR ALIGN=CENTER>







</BLOCKQUOTE></BLOCKQUOTE>







<BR>







<A NAME="E68E100"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>Managing Disk Space</B></FONT></CENTER></H3>







<BR>







<P>UNIX system administrators have a saying: no matter how much disk space you have, it's not enough. This maxim is as true for Linux as it is for UNIX. Disk space has a way of being gobbled up, especially when several users are sharing a system. By the time you have loaded your operating system, favorite applications, compilers, and user files, your disk space is probably close to full. If it isn't, wait six months and it will be.







<BR>







<P>Disk drives are very inexpensive now, so many system administrators prefer to battle the disk space problem by adding larger hard disks or extra disk drives. This option is certainly valid and prevents a lot of hassle cleaning up files, but you still should force some kind of disk space usage policy on yourself and other users to make sure disk space is not wasted. To create such a policy, you have to know how to determine disk space usage, manage disk space effectively, and clean up disks.







<BR>







<BR>







<A NAME="E69E132"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Checking Filesystems</B></FONT></CENTER></H4>







<BR>







<P>Part of Linux's startup routine (driven by an entry in /etc/rc) is to check all mounted filesystems to make sure that they are not damaged or corrupted. This check is performed with every reboot. However, if your machine is not rebooted often or you are experiencing disk errors, start a filesystem check manually.







<BR>







<P>In general, you use the utility fsck (filesystem check) to check filesystems. Linux uses some special versions of fsck to check Linux-dependent filesystems, though, so you may not have direct access to fsck. For example, many Linux versions have a dedicated fsck version called e2fsck to check the ext2 filesystem.







<BR>







<P>When fsck does exist on a Linux version, it is often just a front-end search engine that looks in the /bin, /sbin, /etc/fs, and /etc directories for one of the proper filesystem fsck versions, and then executes that version. The search and execution processes are transparent to you in most cases.







<BR>







<P>The fsck utility does several tasks. As part of its operation, it scans the entire filesystem for any of the following problems:







<BR>







<UL>







<LI>A block shared by many files (cross-linked)







<BR>







<BR>







<LI>Blocks in use but marked as free







<BR>







<BR>







<LI>Inconsistent entries among files and i-node tables







<BR>







<BR>







<LI>Incorrect link counts







<BR>







<BR>



⌨️ 快捷键说明

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