一,首先安装一个linux系统,选择自动分区,并添加五块scsi格式的硬盘。
给系统设置ip地址:[root@localhost ~]# ifconfig eth0 192.168.0.100
[root@localhost ~]# service network restart
二,格式化磁盘并设置分区:
设置分区:
第一块:
[root@localhost ~]# fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
第二块:
[root@localhost ~]# fdisk /dev/sdc
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
第三块:
[root@localhost ~]# fdisk /dev/sdd
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
第四块:
[root@localhost ~]# fdisk /dev/sde
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
第五块:
[root@localhost ~]# fdisk /dev/sdf
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
[root@localhost ~]# fdisk -l #查看分区状况
格式化磁盘分区:
[root@localhost ~]# mkfs.ext3 /dev/sdb1
[root@localhost ~]# mkfs.ext3 /dev/sdc1
[root@localhost ~]# mkfs.ext3 /dev/sdd1
[root@localhost ~]# mkfs.ext3 /dev/sde1
[root@localhost ~]# mkfs.ext3 /dev/sdf1
[root@localhost ~]# partprobe
三,设置raid:
建立raid设备:
[root@localhost ~]# mdadm --create --auto=yes /dev/md1 --level=5 --raid-devices=4 --spare-devices=1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
查看raid设备信息:
[root@localhost ~]# mdadm --detail /dev/md1
格式化raid:
[root@localhost ~]# mkfs.ext3 /dev/md1
设置raid自动挂载:
[root@localhost ~]# mdadm --detail /dev/md1 | grep -i uuid
UUID : 1417c463:8506db54:86c103e2:bea657e0
[root@localhost ~]#
[root@localhost ~]# vim /etc/mdadm.conf
添加:
ARRAY /dev/md1 UUID=1417c463:8506db54:86c103e2:bea657e0
[root@localhost ~]# vim /etc/fstab
添加
/dev/md1 /mnt ext3 defaults 0 0
四,设置磁盘配额:
创建用户和组:
[root@localhost ~]# vim useradd.sh
脚本:
#! /bin/bash
groupadd user
for username in user1 user2 user3 user4 user5 user6 user7 user8 user9 user10
do
useradd -g user $username
etho "123456" |passwd --stdin $username
done
[root@localhost ~]# mount /dev/md1 /mnt
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ls
lost+found
[root@localhost mnt]# mount -o remount,usrquota,grpquota /mnt/
[root@localhost mnt]#
开启加载配额功能:
[root@localhost mnt]# vim /etc/fstab
添加:
/dev/md1 /mnt ext3 defaults,usrquota,grpquota 0 0
[root@localhost mnt]# unmount /mnt/
[root@localhost ]# vim /etc/fstab
[root@localhost mnt]#
[root@localhost mnt]# mount -a
[root@localhost mnt]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hdc on /media/RHEL_5.5 i386 DVD type iso9660 (ro,noexec,nosuid,nodev,uid=0)
/dev/md1 on /mnt type ext3 (rw,usrquota,grpquota)
[root@localhost mnt]#
[root@localhost mnt]# ls
aquota.group aquota.user lost+found
[root@localhost mnt]#
建立数据文件:
[root@localhost mnt]# cd
[root@localhost ~]# quotacheck -avug
quotacheck: Scanning /dev/md1 [/mnt] done
quotacheck: Checked 3 directories and 4 files
[root@localhost ~]#
编辑配额:
[root@localhost mnt]# edquota -u user1
修改:
Disk quotas for user user1 (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/md1 0 25000 30000 0 0 0
[root@localhost mnt]# edquota -p user1 -u user2
[root@localhost mnt]# edquota -p user1 -u user3
[root@localhost mnt]# edquota -p user1 -u user4
[root@localhost mnt]# edquota -p user1 -u user5
[root@localhost mnt]# edquota -p user1 -u user6
[root@localhost mnt]# edquota -p user1 -u user7
[root@localhost mnt]# edquota -p user1 -u user8
[root@localhost mnt]# edquota -p user1 -u user9
[root@localhost mnt]# edquota -p user1 -u user10
[root@localhost mnt]#
[root@localhost mnt]# edquota -u user2
Disk quotas for user user2 (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/md1 0 25000 30000 0 0 0
[root@localhost mnt]# edquota -g user
Disk quotas for group user (gid 500):
Filesystem blocks soft hard inodes soft hard
/dev/md1 0 250000 300000 0 0 0
[root@localhost mnt]# edquota -t 修改宽限时间
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
Filesystem Block grace period Inode grace period
/dev/md1 14days 7days
磁盘配额报告:
[root@localhost mnt]# repquota -auvs
*** Report for user quotas on device /dev/md1
Block grace time: 14days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 180M 0 0 4 0 0
user1 -- 0 25000 30000 0 0 0
user2 -- 0 25000 30000 0 0 0
user3 -- 0 25000 30000 0 0 0
user4 -- 0 25000 30000 0 0 0
user5 -- 0 25000 30000 0 0 0
user6 -- 0 25000 30000 0 0 0
user7 -- 0 25000 30000 0 0 0
user8 -- 0 25000 30000 0 0 0
user9 -- 0 25000 30000 0 0 0
user10 -- 0 25000 30000 0 0 0
Statistics:
Total blocks: 7
Data blocks: 1
Entries: 11
Used average: 11.000000
[root@localhost mnt]#
五,设置软链接:
[root@localhost ~]# ln -s /home /mnt
[root@localhost ~]# cd /home
[root@localhost home]# ll
总计 40
drwx------ 3 user1 user 4096 12-28 15:27 user1
drwx------ 3 user10 user 4096 12-28 15:27 user10
drwx------ 3 user2 user 4096 12-28 15:27 user2
drwx------ 3 user3 user 4096 12-28 15:27 user3
drwx------ 3 user4 user 4096 12-28 15:27 user4
drwx------ 3 user5 user 4096 12-28 15:27 user5
drwx------ 3 user6 user 4096 12-28 15:27 user6
drwx------ 3 user7 user 4096 12-28 15:27 user7
drwx------ 3 user8 user 4096 12-28 15:27 user8
drwx------ 3 user9 user 4096 12-28 15:27 user9
[root@localhost home]# cd
[root@localhost ~]#
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ll
总计 32
-rw------- 1 root root 7168 12-28 15:58 aquota.group
-rw------- 1 root root 7168 12-28 15:59 aquota.user
lrwxrwxrwx 1 root root 5 12-28 16:49 home -> /home
drwx------ 2 root root 16384 12-28 14:51 lost+found
[root@localhost mnt]#
六、日志服务:
首先先对十个用户主机设置ip。一次设置为:
192.168.0.1;192.168.0.2;192.168.0.3;192.168.0.4;192.168.0.5;192.168.0.6;192.168.0.7;192.168.0.8;192.168.0.9;192.168.0.10;
以192.168.0.1为例:
[root@localhost ~]# vim /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
*.* @192.168.0.100
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
在服务器:(192.168.0.100)
[root@localhost ~]# vim /etc/sysconfig/syslog
修改:SYSLOGD_OPTIONS="-m 0 -r"
重启日志服务:
[root@localhost ~]# service syslog restart
关闭内核日志记录器: [确定]
关闭系统日志记录器: [确定]
启动系统日志记录器: [确定]
启动内核日志记录器: [确定]
[root@localhost ~]#
测试:[root@localhost ~]# tail -f /var/log/messages
Dec 28 15:48:47 localhost kernel: Kernel logging (proc) stopped.
Dec 28 15:48:47 localhost kernel: Kernel log daemon terminating.
Dec 28 15:48:48 localhost exiting on signal 15
Dec 28 15:48:48 localhost syslogd 1.4.1: restart (remote reception).
Dec 28 15:48:48 localhost kernel: klogd 1.4.1, log source = /proc/kmsg started.
Dec 28 15:49:06 192.168.0.1syslogd 1.4.1: restart.
Dec 28 15:49:06 192.168.0.1kernel: klogd 1.4.1, log source = /proc/kmsg started.
Dec 28 16:17:50 192.168.0.1nm-system-settings: ifcfg-rh: updating /etc/sysconfig/network-scripts/ifcfg-eth0
Dec 28 16:18:16 192.168.0.1kernel: Kernel logging (proc) stopped.
Dec 28 16:18:16 192.168.0.1kernel: Kernel log daemon terminating.
Dec 28 16:18:17 192.168.0.1exiting on signal 15
[root@localhost ~]# chmod o+w /mnt/
[root@localhost ~]# ll -d /mnt
drwxr-xrwx 3 root root 4096 12-28 16:49 /mnt
[root@localhost ~]# su - user1
[user1@localhost ~]$ cd /mnt
[user1@localhost mnt]$ dd if=/dev/zero of=user1 bs=1M count=25
[user1@localhost mnt]$ dd if=/dev/zero of=user11 bs=1M count=35
md1: write failed, user block limit reached.
dd: 写入 “user11”: 超出磁盘限额.
转载于:https://blog.51cto.com/wuseven/1103448