"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, answerguy@ssc.com
LinuxCare, http://www.linuxcare.com/


(?) Linux as a Job!

Hobbies become fun and profit

From Nate Brazell on Fri, 07 May 1999

(?) I am new to Linux and have a definate need to learn it. It is now my job! Here are a couple of questions???

1. I need to establish a dial up server? How?

(!) mgetty. Install mgetty and follow the directions in its info file (using the emacs/xemacs 'info' package or the standalone 'info' command). You can also read the manual in HTML at:
http://www.leo.org/~doering/mgetty/index.html
mgetty is included with many Linux distributions.

(?) 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.

(!) The hard part is the hardware. Once that's done you just run 'fdisk' then 'mke2fs' (mkfs.ext2) and 'mount' Finally you simply added the new filesystem and mountpoint to your /etc/fstab (so that the system will mount the new filesystem automatically after the next reboot).
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 /dev/hdc. I'm assuming that /dev/hda is your existing OS installation and that /dev/hdb 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).
So you use commands like:
fdisk /dev/hdc
 
# menu interface to configure new filesystems
 
for i in 1 3 5 6 7 8; do
mke2fs -c /dev/hdc$i
done
 
# -c enables automatic 'badblock' checking
# This example assumes you created six filesystems
# on the new drive, perhaps leaving partition two
# as a swap partition and number 4 is used to house
# the extension which contains 5 through 8
# I use a bash/sh for loop to save typing and to
# give me longer to sip my coffee while it works
# unattended
 
mount /dev/hdc1 /home
mount /dev/hdc3 /usr/local
mount /dev/hdc5 /u1
mount /dev/hdc6 /var/log
mount -o sync /dev/hdc7 /var/spool
mount -o noatime /dev/hdc8 /var/spool/news
 
vi /etc/fstab
 
# add the new filesystem(s) as appropriate to
# the fstab file format. See the appropriate
# man page from manual section 5 (i.e. man 5 fstab)
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.
I've glossed completely over the details of mount each of these on a temporary mount point (I use /mnt/tmp) and copying/moving/migrating all the data from the extent directories to their new filesytems. The short form of that is (for each filesystem):
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
.... and there are many variations. Once you've well and truly confirmed that your copies are good you can then rm -fr 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:
(cd $OLDDIR.old && tar cf - . ) |
( cd $NEWDIR && tar df - )
(note the need for line continuation on this example.)
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.
One other note: I've shown a couple of mount examples with options (sync for our spool fs, and noatime for /var/spool/news). 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.
Such options can trade off performance for features or integrity assurance. Tune to taste and serve to your users.

(?) Can you help me?

(!) Yes.

(?) Will you help me?

(!) I hope I already have.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 42 June 1999
HTML transformation by Heather Stern of Starshine Techinical Services, http://www.starshine.org/


[ Answer Guy Index ] 1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]