创建分区的时候,只是创建swap和/(根)分区
配置ip地址
vim /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.18.129
NETMASK=255.255.255.0
HWADDR=00:0C:29:44:FC:64
ONBOOT=yes
DHCP_HOSTNAME=xxx
/etc/init.d/network restart
[root@xxx ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:44:FC:64
inet addr:192.168.18.129 Bcast:192.168.18.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:977 errors:0 dropped:0 overruns:0 frame:0
TX packets:309 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:89783 (87.6 KiB) TX bytes:47351 (46.2 KiB)
Interrupt:67 Base address:0x2000
磁盘阵列
添加三块硬盘
分区:
fdisk /dev/sdb
n>p>1>enter>enter>p>w
fdisk /dev/sdc
n>p>1>enter>enter>p>w
fdisk /dev/sdd
n>p>1>enter>enter>p>w
更新分区:
partprobe
创建分区
[root@xxx ~]# mdadm --create --auto=yes /dev/md1 --level=5 --raid-devices=2 --spare-devices=1 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: array /dev/md1 started.
查看raid设备信息
[root@xxx ~]# mdadm --detail /dev/md1
/dev/md1:
Version : 0.90
Creation Time : Fri Dec 28 12:29:15 2012
Raid Level : raid5
Array Size : 20964672 (19.99 GiB 21.47 GB)
Used Dev Size : 20964672 (19.99 GiB 21.47 GB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Fri Dec 28 12:29:15 2012
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 3
Failed Devices : 0
Spare Devices : 2
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 6% complete
UUID : 420601ac:e0292cb0:5426b591:5ac11574
Events : 0.1
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
3 8 33 1 spare rebuilding /dev/sdc1
2 8 49 - spare /dev/sdd1
格式化
[root@xxx ~]# mkfs.ext3 /dev/md1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5241168 blocks
262058 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
设置自动挂载:
复制UUID
[root@xxx ~]# mdadm --detail /dev/md1 | grep -i uuid
UUID : 370601ac:e0273cb0:5397b591:5ac11436
创建目录
vim /etc/mdadm.conf
ARRAY /dev/md1 UUID=UUID=420601ac:e0292cb0:5426b591:5ac11574
开机启动
vim /etc/fstab
/dev/md1 /home ext3 defaults,usrquota,grpquota 0 0
[root@xxx ~]# mount -a
[root@xxx ~]# ls /home/
lost+found
新建用户
vim laoyu.sh
#!/bin/bash
for laoyu in laoyu1 laoyu2 laoyu3 laoyu4 laoyu5 laoyu6 laoyu7 laoyu8 laoyu9 laoyu10
do
useradd $laoyu
echo "123456" | passwd --stdin $laoyu
done
sh laoyu.sh
laoyu1:x:500:500::/home/laoyu1:/bin/bash
laoyu2:x:501:501::/home/laoyu2:/bin/bash
laoyu3:x:502:502::/home/laoyu3:/bin/bash
laoyu4:x:503:503::/home/laoyu4:/bin/bash
laoyu5:x:504:504::/home/laoyu5:/bin/bash
laoyu6:x:505:505::/home/laoyu6:/bin/bash
laoyu7:x:506:506::/home/laoyu7:/bin/bash
laoyu8:x:507:507::/home/laoyu8:/bin/bash
laoyu9:x:508:508::/home/laoyu9:/bin/bash
laoyu10:x:509:509::/home/laoyu10:/bin/bash
支持配额限制
/dev/md1 on /home type ext3 (rw,usrquota,grpquota)
创建数据文件
quotacheck -avug
[root@xxx ~]# ls /home/
laoyu1 laoyu2 laoyu4 laoyu6 laoyu8 aquota.group lost+found
laoyu10 laoyu3 laoyu5 laoyu7 laoyu9 aquota.user
设置用户配额
edquota -u laoyu1
Disk quotas for user laoyu1 (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/md1 8 100000 200000 2 0 0
[root@xxx ~]# edquota -p laoyu1 -u laoyu2
[root@xxx ~]# edquota -p laoyu1 -u laoyu3
[root@xxx ~]# edquota -p laoyu1 -u laoyu4
[root@xxx ~]# edquota -p laoyu1 -u laoyu5
[root@xxx ~]# edquota -p laoyu1 -u laoyu6
[root@xxx ~]# edquota -p laoyu1 -u laoyu7
[root@xxx ~]# edquota -p laoyu1 -u laoyu8
[root@xxx ~]# edquota -p laoyu1 -u laoyu9
[root@xxx ~]# edquota -p laoyu1 -u laoyu10
开启配额限制
[root@xxx ~]# quotaon -a
[root@xxx ~]# chmod o+w /home/
[root@xxx ~]# su - laoyu1
cd /home/
cd laoyu1
dd if=/dev/zero of=laoyu.txt bs=1M count=105
md1: warning, user block quota exceeded.
105+0 records in
105+0 records out
110100480 bytes (110 MB) copied, 1.07717 seconds, 102 MB/s
dd if=/dev/zero of=laoyu1.txt bs=1M count=105
md1: write failed, user block limit reached.
dd: 写入 “laoyu1.txt”: 超出磁盘限额
91+0 records in
90+0 records out
94474240 bytes (94 MB) copied, 0.952971 seconds, 99.1 MB/s
90+0 records out
94474240 bytes (94 MB) copied, 0.952971 seconds, 99.1 MB/s
exit
[root@xxx ~]# repquota -avs
*** Report for user quotas on device /dev/md1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
laoyut -- 173M 0 0 4 0 0
laoyu1 +- 196M 100000 196M 6days 5 0 0
laoyu2 -- 8 100000 196M 2 0 0
laoyu3 -- 8 100000 196M 2 0 0
laoyu4 -- 8 100000 196M 2 0 0
laoyu5 -- 8 100000 196M 2 0 0
laoyu6 -- 8 100000 196M 2 0 0
laoyu7 -- 8 100000 196M 2 0 0
laoyu8 -- 8 100000 196M 2 0 0
laoyu9 -- 8 100000 196M 2 0 0
laoyu10 -- 8 100000 196M 2 0 0
Statistics:
Total blocks: 7
Data blocks: 1
Entries: 11
Used average: 11.000000
日志(客户端配置)
vim /etc/syslog.conf
*.* @192.168.18.3
[root@xxx ~]# /etc/init.d/syslog restart
关闭内核日志记录器: [确定]
关闭系统日志记录器: [确定]
启动系统日志记录器: [确定]
启动内核日志记录器: [确定]
日志(服务器)
vim /etc/sysconfig/syslog
SYSLOGD_OPTIONS="-m 0 -r"
[root@laoyu ~]# service syslog restart
关闭内核日志记录器: [确定]
关闭系统日志记录器: [确定]
启动系统日志记录器: [确定]
启动内核日志记录器: [确定]