📄 yolinux tutorial linux system configuration and administration.mht
字号:
<LI>Mounting a floppy:=20
<UL>
<LI>Mount MS-DOS floppy: <TT>mount /dev/fd1 -t vfat =
/mnt/floppy</TT>=20
<P>Also see the <A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialUsingDOSFloppies.ht=
ml">YoLinux=20
tutorial on using MS-DOS floppies with Linux</A>. </P>
<LI>Unix floppy: <A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialRecoveryAndBootDisk=
.html#LILO">See=20
YoLinux Tutorial - Linux Recovery and Boot Disk Creation</A> =
</LI></UL>
<P></P>
<LI>Ramdisk: Using a portion of RAM memory to act like a =
superfast disk.=20
<PRE> /sbin/mkfs -t ext2 /dev/ram
mount /dev/ram /mnt/ramd
</PRE><B><FONT color=3D#ff0000>[Potential Pitfall]:</FONT></B> I've=20
never actually tried this. Use at your own risk!=20
<P>See <A=20
=
href=3D"http://www.linuxfocus.org/English/November1999/article124.html">H=
ow=20
to use a Ramdisk for Linux</A> </P></LI></UL>
<P>
<HR>
<P>
<UL>
<LI>Add system swap space for virtual memory paging: <BR>Swap =
space may=20
be a swap partition, a swap file or a combination of the two. =
One should=20
size swap space to be at least twice the size of the computer's =
RAM.=20
(but less than 2GB) <PRE> dd if=3D/dev/zero of=3D/swapfile =
bs=3D1024 count=3D265032 <B><I>- Create file filled with zeros of size =
256Mb</I></B>
mkswap /swapfile <B><I>- Create swap file</I></B>
swapon /swapfile <B><I>- Begin use of given swap file. Assign =
a priority with the "-p" flag.</I></B>
swapon -s <B><I>- List swap files</I></B>
cat /proc/swaps <B><I>- Same as above</I></B>
</PRE>This example refers to a swap file. One may also use a swap=20
partition. Make entry to <TT>/etc/fstab</TT> to permanently use =
swap=20
file or partition.=20
<DL>
<DD>
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>/swapfile swap =
swap defaults 0 0
</PRE></TD></TR></TBODY></TABLE></DD></DL>
<P>Note: To remove the use of swap space, use the command=20
<TT>swapoff</TT>. If using a swap partition, the partition must =
be=20
unmounted.=20
<P>Man pages:=20
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dswapon">=
swapon/swapoff</A>=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmkswap">=
mkswap</A>=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfstab">f=
stab</A>=20
</LI></UL></LI></UL>
<P>
<HR>
<P>
<UL>
<LI><A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialAdditionalHardDrive=
.html">YoLinux=20
Tutorial: Adding an Additional Hard Drive to Your Linux =
System</A>=20
<LI><A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialOptimization.html#H=
DPARM">YoLinux=20
Tutorial: System Optimization and hdparm</A>=20
<LI><A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialRedHatInstallation.=
html#WINPARTITION">Mounting=20
a Windows partition or other file systems.</A>=20
<LI><A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialQuotas.html">YoLinu=
x=20
Tutorial: File System Quotas</A>=20
<LI><A=20
=
href=3D"http://www.yolinux.com/HOWTO/mini/Hard-Disk-Upgrade.html">Hard=20
Disk Upgrade Mini How-To</A> </LI></UL>
<P>
<HR>
<P><B>Increase open files limit:</B>=20
<P><PRE> cat /proc/sys/fs/file-max <B><I>- Kernel configuration =
for max number of files</I></B>
cat /proc/sys/fs/file-nr <B><I>- Number of files presently =
open</I></B>
echo 4096 > /proc/sys/fs/file-max <B><I>- Set max file limit. =
(This is default)</I></B> =20
cat /proc/sys/fs/inode-max <B><I>- Kernel 2.2 configuration for max =
number of inodes</I></B>
To change: echo 12288 > =
/proc/sys/kernel/inode-max
</PRE>
<P>
<UL>
<LI>See:=20
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dproc">pr=
oc</A>=20
man page - process information pseudo-filesystem=20
<LI>Local file Kernel 2.2 (RH 7.0-):<A=20
=
href=3D"file:///usr/src/linux/Documentation/proc.txt">file:/usr/src/linux=
/Documentation/proc.txt</A>=20
(local file) - <A=20
=
href=3D"http://www.linuxhq.com/kernel/v2.2/doc/proc.txt.html">[WEB]</A>=20
</LI></UL></LI></UL>
<P>
<HR>
<P><B>Reboot count and fsck:</B>=20
<P>
<DL>
<DD>Pertains to Red Hat systems using the EXT2 filesystem (RH =
7.2+ uses=20
EXT3)=20
<P>After 20 reboots of the system, Linux will perform a file =
system=20
check using <TT>fsck</TT>. This is annoying for systems with =
many file=20
systems because they will all be checked at once. The individual =
file=20
system's mount count may be changed so that they will be checked =
on a=20
different reboot.=20
<P>Check current reboot status: <TT>/sbin/dumpe2fs /dev/sdb6 | =
grep=20
'[mM]ount count'</TT>=20
<DL>
<DD><PRE>dumpe2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
Mount count: 2
Maximum mount count: 20
</PRE></DD></DL>(This of course is specific for my system. Refer to your =
particular filesystem.)=20
<P>Perform the previous command on all the filesystems to obtain =
their=20
mount counts. Next change the mount counts for some of them.=20
<DL>
<DD><PRE>umount /dev/sdb6
tune2fs -C 9 /dev/sdb6
mount /dev/sdb6
</PRE></DD></DL>Now the filesystems will have an <TT>fsck</TT> performed =
on them on different system boots rather than all at the same =
time.=20
<P>For home users who routinely shutdown and boot their systems, =
one can=20
increase the maximum mount count: <TT>tune2fs -c 40</TT> =
<BR>This=20
feature can also be disabled: <TT>tune2fs -c -1</TT> <BR>Check =
every=20
week: <TT>tune2fs -i 7</TT> </P></DD></DL>
<P>
<HR>
<P><B>System crash and disk check upon boot:</B>=20
<P>
<DL>
<DD>Pertains to Red Hat 7.1 EXT2 filesystems and earlier which =
require=20
an integrity check. (RH 7.2+ uses EXT3 which is a journaled file =
system=20
which maintains file system integrity even with a crash.)=20
<P>If the system crashes (due to power outage etc...) then upon =
boot the=20
system will check if the disk was unmounted cleanly. If not you =
may get=20
the following message:=20
<DL>
<DD><SMALL><PRE>Unexpected inconsistency; Run fsck Manually
...
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
...
.
Give root password for maintenance
(or type Control-D for normal startup):
</PRE></SMALL></DD></DL>At this point enter the root password then run=20
fsck:=20
<DL>
<DD><SMALL><PRE>(repair file system) 1# fsck -A -y
...
..
.
***** FILE SYSTEM WAS MODIFIED *****
...
..
.
(repair file system) 2# exit
</PRE></SMALL></DD></DL>The system will hopefully reboot properly at=20
this point. <BR><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfsck">fs=
ck=20
man page</A> <BR>Note that <TT>fsck</TT> is NOT run against =
mounted file=20
systems. </DD></DL>
<P>
<HR>
<P><B>Journaled Filesystem EXT3:</B>=20
<P>
<DL>
<DD>Convert from ext2 to ext3:=20
<UL>
<LI>Red Hat 7.2 upgrade gives one the option to perform this =
file=20
system upgrade.=20
<LI>Manual method:=20
<UL>
<LI>Convert: <TT>tune2fs -j /dev/hda1</TT>=20
<LI>Configuration file changes: <TT>/etc/fstab</TT> change=20
<TT>ext2</TT> to <TT>ext3</TT> </LI></UL></LI></UL>Also see: =
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dtune2fs"=
>tune2fs=20
Man Page</A>=20
<LI><A=20
=
href=3D"http://linuxtoday.com/news_story.php3?ltsn=3D2001-08-22-004-20-NW=
-RH">Linux=20
today: EXT3 info</A>=20
<LI><A =
href=3D"http://people.spoiled.org/jha/ext3-faq.html">EXT3 Faq</A>=20
</LI></UL>
<P>Other journaled file systems: SGI XFS, IBM JFS and reiserfs. =
For=20
files larger than 2Gb use <A =
href=3D"http://oss.sgi.com/projects/xfs/">SGI=20
XFS and the SGI Linux Red Hat RPM or Red Hat ISO CD install =
image</A>.=20
</P></DD></DL>
<P>
<HR>
<P><B>Raw Devices:</B> Commercial databases such as Oracle and IBM =
DB2 can=20
maximize performance by using raw I/O. One may use the raw command =
for=20
both IDE and SCSI devices. This will map a raw device to a blocked =
device=20
for an entire disk partition. To see if your system is using raw =
I/O issue=20
the command: <TT>raw -a</TT>=20
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Draw"><TT=
>raw</TT>=20
man page</A>=20
<LI>Configuration file: <TT>/etc/sysconfig/rawdevices</TT> =
<BR>Add=20
entries to this file to invoke raw I/O upon system boot.=20
<LI>Devices: <TT>/dev/raw/raw<I>??</I></TT>=20
<LI>Raw device controller: <TT>/dev/rawctl</TT>=20
<LI>Sample use of command: <TT>raw /dev/raw/raw1 /dev/hdb5</TT>=20
<LI>One must be of group <TT>disk</TT> to use the raw device or =
change=20
permissions: <SMALL>
<UL>
<LI><TT>chmod a+r /dev/rawctl</TT>=20
<LI><TT>chmod a+r /dev/hdb5</TT>=20
<LI><TT>chmod a+rw /dev/raw/raw1</TT> =
</LI></UL></SMALL></LI></UL>
<P>Note: The above information applies to Red Hat distributions. =
This info=20
may be different for other distributions. i.e. S.U.S.E. uses=20
<TT>/dev/raw1</TT> as a device and <TT>/dev/raw</TT> as the =
controller.=20
<BR>You can mimic Red Hat behavior with a symbolic link: <TT>ln -s =
/dev/your_raw_controller /dev/rawctl</TT> <A name=3DNFS></A>
<P>
<HR>
<P><B>Mounting Network Drives:</B>=20
<UL>
<LI><B>SMB Mount:</B> <A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialMicrosoftWindowsNet=
workIntegration.html#MOUNTFILESERVER">Mounting=20
a Microsoft Windows shared file server drive</A>=20
<LI><B>NFS:</B> Mounting/exporting a Linux shared file server =
drive with=20
NFS.=20
<TABLE border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TH>Client</TH>
<TH>Server</TH></TR>
<TR>
<TD vAlign=3Dtop>File: <TT>/etc/fstab</TT>=20
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>...
<I>server</I>:/<I>directory-to-export</I> <I>/mnt/mount-point</I> nfs =
rw,hard,intr 0 0
server1:/shared/images /mnt/srv1-images nfs rw,hard,intr 0 0
...
</PRE></TD></TR></TBODY></TABLE>Hard mount read/write.=20
Mount can be interrupted by the kill command.=20
<P>Command line mount: <TT>mount -t nfs=20
<I>server1</I>:/shared/images /mnt/srv1-images</TT> =
</P></TD>
<TD vAlign=3Dtop>File: <TT>/etc/exports</TT>=20
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>...
/shared/images 176.168.1.0/255.255.255.0(rw)
...
</PRE></TD></TR></TBODY></TABLE>List of directories to=20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -