| < Day Day Up > |
|
In Chapter 4, "Disk configuration" on page 49 there is a discussion of the different filesystems available with Linux. In this section we address the types of commands Linux administrators might need to use in their day-to-day support of the system.
Before the physical volumes can be created, they must first be formatted and partitioned for Linux, whether running under VM or native. This is done using the dasdfmt and fdasd commands.
To format a single DASD with the recommended block size of 4 KB, use:
dasdfmt -b 4096 -f /dev/dasdg
The fdasd command allows you to split a DASD into several partitions. To create a single partition on formatted DASD, use the fdasd command with the -a option:
fdasd -a /dev/dasdg Note: -a option is to auto-create one partition in non-interactive mode
If running Linux under VM, you can use the CMS format and the RESERVE command to prepare the physical device under VM. The VM minidisk device driver can only be used with CMS-format minidisks.
To format a minidisk, use the CMS command:
FORMAT <device number> <filemode> (blksize <blksize> for example: FORMAT 202 D
Use the RESERVE command to allocate all available blocks of a formatted CMS minidisk to a unique CMS file:
RESERVE linux mdisk <filemode> for example: RESERVE LINUX DIAG D
This is what is recommended for minidisks, since the CMS label/volid information is preserved, provided the filesystem is created on a Linux device partition.
Note | Use of the dasdfmt command is not recommended for minidisks, since it will destroy any CMS label/volid information. |
The mke2fs command is used to create an ext2/ext3 filesystem (usually in a disk partition). To create an empty ext2 filesystem after formatting the device, use the command mke2fs.
Here is the syntax:
mke2fs [-b <block size>] /dev/dasd<n>1 | /dev/xpram<n> for example: mke2fs -b 4096 /dev/dasdg
Use the -j option to create the filesystem with an ext3 journal. Note that you must be using a kernel which has ext3 support in order to actually make use of the journal. Our SLES-8 system had the appropriate support for ext3 journaling. For example, to create an ext3 filesystem on lv01, issue:
mke2fs -j -b 4096 /dev/vg01/lv01
A mount point is a directory that is usually empty. If it is not empty, any files it might contain are hidden as long as a filesystem is mounted over it. Manual mounting is done with the mount command:
mount -t type dev mountpoint
The following command mounts the filesystem that is on /dev/dasdg1 over the directory /mnt:
mount -t ext2 /dev/dasdg1 /mnt
Note | To automatically mount a filesystem on startup, add an entry in /etc/fstab. |
For an extensive overview of LVM, refer to Chapter 4, "Disk configuration" on page 49. The following are some common commands that you can use when managing your LVMs.
To initialize a physical volume, use pvcreate:
Syntax: pvcreate /dev/hdb For example: pvcreate /dev/dasdl /dev/dasdm1
To create a volume group, use vgcreate:
Syntax: vgcreate my_volume_group /dev/hda1 /dev/hdb1
For example, to create the volume group named vg01, you issue:
vgcreate vg01 /dev/dasdl1 /dev/dasdm1
To display the attributes of volume groups such as size, use vgdisplay:
Syntax: vgdisplay my_volume_group For example: vgdisplay /dev/vg01
To add physical volumes to a volume group, use vgextend. To add an initialized physical volume to an existing volume group:
vgextend my_volume_group /dev/hdc1 where hdc1 is the new physical volume
To extend a logical volume, use e2fsadm. LVM has a utility called e2fsadm to allow resizing of a logical volume containing an ext2 or ext3 filesystem:
Syntax: e2fsadm -L xxG /dev/myvg/homevol
For example, to extend /dev/vg01/lv01 filesystem using VG, issue:
e2fsadm -L 20G /dev/vg01/lv01
Important: | You will still need to unmount the filesystem before running e2fsadm. |
You can use the df command to monitor disk usage and to determine if you need to increase the capacity of your Domino server filesystems. You will need to work together with the Domino Administrator if you need to expand a filesystem (such as extending an LVM), because the Domino Server has to be shut down and the filesystem unmounted to perform this function.
You will also want to check on a regular basis to see if your filesystems are getting full. To monitor your filesystems for a specific threshold (for example, 75%), there are Tivoli and other third-party tools that you can use. Refer to Linux on IBM server zSeries and S/390: System Management, SG24-6820 for more information on this topic. This can also be done with Domino tools; for more information refer to 8.3.1, "System monitoring tools" on page 182.
The df command displays information about the filesystem, including the total amount in the filesystem, the amount used, and the amount available. Example 9-1 shows the output from the df command.
Example 9-1: df command
root@linuxa:/ > df Filesystem 1K-blocks Used Available Use% Mounted on /dev/dasdb1 2259188 1067352 1191836 48% / /dev/dasdc1 2403184 1538872 864312 65% /opt shmfs 257140 0 257140 0% /dev/shm /dev/dasdt1 2365444 1453272 792012 65% /domserva /dev/mail1/mail1 16509864 216116 15455092 2% /domserva/notesdata/mail1 /dev/mail2/mail2 16509864 20 15671188 1% /domserva/notesdata/mail2 /dev/translog/translog 4313840 2099480 1995224 52% /domserva/notesdata/translog
Example 9-2 shows df with the -h option from our test server. df -h shows the space in more "human readable" format (size is displayed in M or G).
Example 9-2: df -h command
root@linuxa:/ > df -h Filesystem Size Used Avail Use% Mounted on /dev/dasdb1 2.2G 1.1G 1.2G 48% / /dev/dasdc1 2.3G 1.5G 845M 65% /opt shmfs 252M 0 252M 0% /dev/shm /dev/dasdt1 2.3G 1.4G 774M 65% /domserva /dev/mail1/mail1 16G 212M 15G 2% /domserva/notesdata/mail1 /dev/mail2/mail2 16G 20K 15G 1% /domserva/notesdata/mail2 /dev/translog/translog4.2G 2.1G 2.0G 52% /domserva/notesdata/translog
You can also display the filesystem usage (as shown in Figure 9-1 on page 221) with the Resource Measurement Facility Performance Monitoring (RMF PM) tool, which we describe in 9.3.2.
Figure 9-1: Filesystem free space display using RMF-PMS
For user ID administration from the command line, you can run useradd or userdel to add or delete a user. Or you can use a graphical desktop environment, such as SuSE's YaST2 or KDE User Manager, to manage your accounts.
You can create a user account using the command useradd. This command creates a new user. It is in the /usr/sbin directory, which you might need to add to your PATH:
Syntax: useradd [-d <home>][-g <group>] [-G additional groups>] [-m] [-s <shell>] [-u <uid>] [-p passwd] <username>
For example, to add a user named user1, issue the command:
useradd -m -d /home/user1 -p dummypw -c 'John Smith' user1
This user will have the password dummypw, which can be changed using the passwd command. An entry will be created in the file /etc/passwd.
The following is the format of the passwd entries file:
user:password:uid:gid:description:home:login_shell
The userdel command deletes a user; here is the syntax:
userdel -r user2
If you need to change the permissions (mode) of files or directories, you can use the chmod command.
chmod [-r] permissions filename i.e. chmod 755 filename
You may also need to change the owner or group that is assigned to a file or directory. This can be done using the chown command.
chown newowner:group directory_path
For example, if you create a new filesystem and mount it, you may have to change the permissions to make the Domino server user ID as the owner of that directory.
chown domserva:notes domserva/notesdata
You can also change in the subdirectories of the directory that you are currently in "recursively" by using the -R option:
chown -R userid directory_path
Shell scripts can be used to manage your Linux server. The crontab scheduler in Linux automates the process of running these scripts. You can have several scripts for maintaining your server, and you can use crontab to run them at specified times. To list the scheduled programs in crontab, log in as root and issue crontab -l.
For example, it is a good practice to clean up your core dumps on a regular basis so that your filesystems do not fill up. You can write a script to do this and schedule it to run every day. To run a cleanup script every day at 1 a.m., set up the following cron job:
0 1 * * * ~/cleanup.sh 1>/dev/null 2>&1
Note | The ~ symbol refers to the home directory. |
Linux keeps logs in /var/log unless the administrator changes the path. The daemon (program) responsible for generating the logs is syslogd. Log entries are caused by events, and almost every application can send information (events) to the syslogd. The default is to start the syslogd daemon when Linux starts. Also by default, all system messages go in the /var/log/messages file. A sample messages file is shown in Example 9-3.
Example 9-3: Messages log
root@linuxa:/ > tail -f /var/log/messages Aug 12 09:56:59 linuxa sshd[16338]: Failed password for root from ::ffff:1.23.4.5 port 1179 Aug 12 09:57:03 linuxa sshd[16338]: Accepted password for root from ::ffff:1.23.4.5 port 1179 Aug 12 09:59:00 linuxa /USR/SBIN/CRON[16417]: (root) CMD ( rm -f /var/spool/cron/lastrun/cron.hourly) Aug 12 10:00:00 linuxa /USR/SBIN/CRON[16442]: (root) CMD ( /usr/lib/sa/sa1 ) Aug 12 10:10:00 linuxa /USR/SBIN/CRON[17347]: (root) CMD ( /usr/lib/sa/sa1 ) Aug 12 10:20:00 linuxa /USR/SBIN/CRON[17395]: (root) CMD ( /usr/lib/sa/sa1 ) Aug 12 10:30:00 linuxa /USR/SBIN/CRON[17426]: (root) CMD ( /usr/lib/sa/sa1 ) Aug 12 10:33:20 linuxa sshd[17457]: Accepted password for domserva from ::ffff:1.23.4.5 port 1184 Aug 12 10:33:20 linuxa sshd[17459]: fatal: PAM session setup failed[6]: Permission denied Aug 12 10:33:39 linuxa sshd[17462]: Accepted password for root from ::ffff:1.23.4.5 port 1185
The log files can be redirected to other paths by editing the syslog.conf or by moving the file and creating a link to the new location. In order to see the log information in real time, log in as root and at the shell command prompt, issue tail -f /var/log/messages, as we did in Example 9-3. This tail command will display the last few lines the log file and continue to display new lines until you exit (usually with Ctlr+C).
Linux servers can be administered remotely, and many tools are available to do this. Webmin and VNC are two tools that are described in detail in Domino 6 for Linux, SG24-6835.
| < Day Day Up > |
|