范金楠考试作业

先创建一个自动分区的系统,
然后配置IP setup IP为 192.168.18.81

磁盘阵列
添加5块硬盘,进行格式化,然后 partprobe重分区表
mdadm --create --auto=yes  /dev/md1 --level=5 --raid-devices=4 --spare-devices=1 /dev/sdb1 /dev/sdc1 /dev/sdd1
/dev/sde1 /dev/sdf1 
mdadm: array /dev/md1 started.表示加载成功
查看raid设备信息:
mdadm --detail /dev/md1
然后格式化
mkfs.ext3 /dev/md1

创建目录
vim /etc/mdadm.conf
ARRAY /dev/md1  UUID=2a329fed:006bd9f2:1fd6f751:1b9dd5df


开启磁盘配额功能
   mount -o remount,usrquota,grpquota /home
配置开始制动加载fstab配置文件
   vim /etc/fstab
/dev/md1                /media             ext3    defaults,usrquota,grpquota         0 0


添加用户,用shell脚本做
vim abc.sh

#!/bin/bash
for abc in q1 a2 a3 a4 a5 a6 a7 a8 a9 a10
do
useradd $abc
echo  "123456" | passwd --stdin $abc
done

 

建立数据文件
quotacheck -avug
查看 ls /home/
会生成两个文件aquota.group   lost+found   aquota.user
ln -s /home/ home
lrwxrwxrwx 1 root  root      5 12-28 17:28 home -> /home/

设置用户配额
edquota -u abc1

 Disk quotas for user abc1 (uid 500):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/md1                         0      200000       300000     0        0        0
 edquota -p a1 -u q2
 ......................
 edquota -p a1 -u 10

开启配额限制
quotaon -a
su - a1
dd if=/dev/zero of=a1 bs=1M count=270
md1: warning, user block quota exceeded.

dd if=/dev/zero of=a1.txt bs=1M count=200
md1: write failed, user block limit reached.
dd: 写入 “a1.txt”: 超出磁盘限额
91+0 records in
90+0 records out
94474240 bytes (88 MB) copied, 0.952971 seconds, 90.2 MB/s
 
90+0 records out
94474240 bytes (87 MB) copied, 0.952971 seconds, 90.0 MB/s

日志(客户端配置)
vim /etc/syslog.conf
*.*                                                    @192.168.18.10
/etc/init.d/syslog restart
关闭内核日志记录器:                                       [确定]
关闭系统日志记录器:                                       [确定]
启动系统日志记录器:                                       [确定]
启动内核日志记录器:                                       [确定]
chkconfig --level 35 syslog on

日志(服务器)
 vim /etc/sysconfig/syslog
SYSLOGD_OPTIONS="-m 0 -r"
 service syslog restart
关闭内核日志记录器:                                       [确定]
关闭系统日志记录器:                                       [确定]
启动系统日志记录器:                                       [确定]
启动内核日志记录器:                                       [确定]
chkconfig --level 35 syslog on

查看日志是否传送成功
ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:B1:BD:2E 
          inet addr:192.168.18.81  Bcast:192.168.18.255  Mask:255.255.255.0
tail -f /var/log/messages

 

 

 

你可能感兴趣的:(考试)