old-www/LDP/LG/issue42/tag/14.html

281 lines
10 KiB
HTML

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.2J.g">
<TITLE>The Answer Guy 42: Linux as a Job!</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="(?)"
border="0" align="middle">
<font color="#B03060">The Answer Guy</font>
<img src="../../gx/dennis/bbubble.gif" alt="(!)"
border="0" align="middle">
</A></H1>
<BR>
<H4>By James T. Dennis,
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
LinuxCare,
<A HREF="http://www.linuxcare.com/">http://www.linuxcare.com/</A>
</H4>
</center>
<p><hr><p>
<!-- endcut ======================================================= -->
<!-- begin 15 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Linux as a Job!</H3>
<H4 ALIGN="center">
Hobbies become fun and profit</H4>
<p><strong>From Nate Brazell on Fri, 07 May 1999
</strong></p>
<!-- ::
Linux as a Job!
~~~~~~~~~~~~~~~
Hobbies become fun and profit
:: -->
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I am new to Linux and have a definate need to learn it. It is now my
job! Here are a couple of questions???
</STRONG></P>
<P><STRONG>
1. I need to establish a dial up server? How?
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
<tt>mgetty</tt>. Install <tt>mgetty</tt> and follow the directions in
its info file (using the emacs/xemacs '<tt>info</tt>' package
or the standalone '<tt>info</tt>' command). You can also read
the manual in HTML at:
</BLOCKQUOTE>
<BLOCKQUOTE><BlockQuote><code>
<A HREF="http://www.leo.org/~doering/mgetty/index.html"
>http://www.leo.org/~doering/mgetty/index.html</A>
</code></BlockQuote></BLOCKQUOTE>
<BLOCKQUOTE>
<tt>mgetty</tt> is included with many Linux distributions.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
2. I need to install a new drive and mount an existing file system to
the new drive. This one I know how to do, however I haven't messed with
UNIX in a while and want to make sure my plan will work.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The hard part is the hardware. Once that's done you
just run '<tt>fdisk</tt>' then '<tt>mke2fs</tt>' (<tt>mkfs.ext2</tt>) and
'<tt>mount</tt>' Finally you simply added the new filesystem and
mountpoint to your <TT>/etc/fstab</TT> (so that the system will mount
the new filesystem automatically after the next reboot).
</BLOCKQUOTE>
<BLOCKQUOTE>
Here's a couple of sample commands assuming that your adding
an IDE drive to a system's secondary controller. The
new drive will be <TT>/dev/hdc</TT>. I'm assuming that <TT>/dev/hda</TT>
is your existing OS installation and that <TT>/dev/hdb</TT> is a
CD-ROM slaved off of the same controller; that's best
since CDs are accessed relatively infrequently and most
often just to copy things to your local volume. Thus
putting the new drive on the other IDE chain in a typical
modern system gives a performance boost. Only one drive
per IDE chain can be accessed at any given modem by the
kernel. SCSI allows commands to the drives to be handled
in parallel (the request is issued, the drive is
"disconnected" from the bus and it issues an interrupt
when it is ready to provide or fetch more data).
</BLOCKQUOTE>
<BLOCKQUOTE>
So you use commands like:
</BLOCKQUOTE>
<BLOCKQUOTE><BlockQuote><Code>
fdisk /dev/hdc
<br>&nbsp;
<BR># menu interface to configure new filesystems
<br>&nbsp;
<br>for i in 1 3 5 6 7 8; do
<br>mke2fs -c /dev/hdc$i
<br>done
<br>&nbsp;
<BR># -c enables automatic 'badblock' checking
<BR># This example assumes you created six filesystems
<BR># on the new drive, perhaps leaving partition two
<BR># as a swap partition and number 4 is used to house
<BR># the extension which contains 5 through 8
<BR># I use a bash/sh for loop to save typing and to
<BR># give me longer to sip my coffee while it works
<BR># unattended
<br>&nbsp;
<br>mount /dev/hdc1 /home
<br>mount /dev/hdc3 /usr/local
<br>mount /dev/hdc5 /u1
<br>mount /dev/hdc6 /var/log
<br>mount -o sync /dev/hdc7 /var/spool
<br>mount -o noatime /dev/hdc8 /var/spool/news
<br>&nbsp;
<br>vi /etc/fstab
<br>&nbsp;
<BR># add the new filesystem(s) as appropriate to
<BR># the fstab file format. See the appropriate
<BR># man page from manual section 5 (i.e. man 5 fstab)
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
In this (admittedly complicated) example I've put the
new filesystems on a few mount points that often need
to "grow" or are otherwise good candidates for having
their own filesystems.
</BLOCKQUOTE>
<BLOCKQUOTE>
I've glossed completely over the details of mount each of
these on a temporary mount point (I use <TT>/mnt/tmp</TT>) and
copying/moving/migrating all the data from the extent
directories to their new filesytems. The short form
of that is (for each filesystem):
</BLOCKQUOTE>
<BLOCKQUOTE><BlockQuote><pre>
mount $NEWFS /mnt/tmp
cp -pax $OLDDIR /mnt/tmp
umount /mnt/tmp
mv $OLDDIR $OLDDIR.old
mkdir $OLDDIR
chmod $OLD_DIR_PERMS $OLDDIR
mount $NEWFS $OLDDIR
</pre></BlockQuote></BLOCKQUOTE>
<BLOCKQUOTE>
.... and there are many variations. Once you've well
and truly confirmed that your copies are good you can then
<tt>rm -fr</tt> each of the $OLDDIR.old directories. One way to
compare two directory trees and ensure that the data and
the metadata (ownership and permissions) have been
faithfully replicated is to use a command like:
</BLOCKQUOTE>
<BLOCKQUOTE><BlockQuote><Code>
(cd $OLDDIR.old &amp;&amp; tar cf - . ) |
<Br>( cd $NEWDIR &amp;&amp; tar df - )
</Code></BlockQuote></BLOCKQUOTE>
<BLOCKQUOTE>
(note the need for line continuation on this example.)
</BLOCKQUOTE>
<BLOCKQUOTE>
Note: In all of these preceding examples I've only
give the basic idea. You should NOT just cut and paste
these commands without understanding them and editing them
to suit your actual needs and situation.
</BLOCKQUOTE>
<BLOCKQUOTE>
One other note: I've shown a couple of mount examples
with options (<tt>sync</tt> for our spool fs, and <tt>noatime</tt> for
<TT>/var/spool/news</TT>). One of the key advantages to using
smaller, more focused filesystems is that you can then
apply mount options that are appropriate to them.
You can greatly increase the performce of a newspool
by preventng the kernel's fs drivers from updating the
"Access Time" (atime) stamps on each file each time it
is read. You can greatly reduce the risk of data damage
to your mail spools and queue using the sync option (so that
a catastrophic power supply failure or bump of the "off"
switch is less likely to mangle the filesystem.
</BLOCKQUOTE>
<BLOCKQUOTE>
Such options can trade off performance for features or
integrity assurance. Tune to taste and serve to your users.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Can you help me?
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Yes.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Will you help me?
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I hope I already have.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 15 -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 1999, James T. Dennis
<BR>Published in <I>The Linux Gazette</I> Issue 42 June 1999</H5>
<H6 ALIGN="center">HTML transformation by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Techinical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6>
<P> <hr> <P>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<TABLE WIDTH="97%"><TR VALIGN="center" ALIGN="center">
<TD ROWSPAN="4" COLSPAN="1" WIDTH="37%"><A
HREF="../lg_answer42.html"
><IMG SRC="../../gx/dennis/answernew.gif"
ALT="[ Answer Guy Index ]"></A></td>
<TD WIDTH="10%"><A HREF="1.html">1</A></TD>
<TD WIDTH="10%"><A HREF="2.html">2</A></TD>
<TD WIDTH="10%"><A HREF="3.html">3</A></TD>
<TD WIDTH="10%"><A HREF="4.html">4</A></TD>
<TD WIDTH="10%"><A HREF="5.html">5</A></TD>
<TD WIDTH="10%"><A HREF="6.html">6</A></TD>
</TR><TR VALIGN="center" ALIGN="center">
<TD><A HREF="7.html">7</A></TD>
<TD><A HREF="8.html">8</A></TD>
<TD><A HREF="9.html">9</A></TD>
<TD><A HREF="10.html">10</A></TD>
<TD><A HREF="11.html">11</A></TD>
<TD><A HREF="12.html">12</A></TD>
</TR><TR VALIGN="center" ALIGN="center">
<TD><A HREF="13.html">13</A></TD>
<TD><A HREF="14.html">14</A></TD>
<TD><A HREF="15.html">15</A></TD>
<TD><A HREF="16.html">16</A></TD>
<TD><A HREF="17.html">17</A></TD>
<TD><A HREF="18.html">18</A></TD>
</TR><TR VALIGN="center" ALIGN="center">
<TD><A HREF="19.html">19</A></TD>
<TD><A HREF="20.html">20</A></TD>
<TD><A HREF="21.html">21</A></TD>
<TD><A HREF="22.html">22</A></TD>
<TD><A HREF="23.html">23</A></TD>
<TD><A HREF="24.html">24</A></TD>
</TR></TABLE>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<P> <hr> <P>
<!-- begin lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<A HREF="../../index.html"
><IMG SRC="../../gx/indexnew.gif" ALT="[ Table Of Contents ]"></A>
<A HREF="/index.html"
><IMG SRC="../../gx/homenew.gif" ALT="[ Front Page ]"></A>
<A HREF="../lg_bytes42.html"
><IMG SRC="../../gx/back2.gif" ALT="[ Previous Section ]"></A>
<A HREF="../lg_tips42.html"
><IMG SRC="../../gx/fwd.gif" ALT="[ Next Section ]"></A>
<!-- end lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
</BODY></HTML>
<!--endcut ========================================================= -->