raid

1.创建五块新磁盘

2. 分区:fdisk /dev/sdb n p 1 2610 w
格式化磁盘:mkfs.ext3 /dev/sdb1
强制内核更新分区表:partprobe

其他四块同样操作

3.建立RAID设备:mdadm --create --auto=yes /dev/md1 --level=5 --raid-devices=4 --spare-devices=1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
格式化md1:mkfs.ext3 /dev/md1
挂载md1:mount /dev/md1 /mnt/raid5
查看是否挂载成功:
查看raid mdadm --detail /dev/md1
获得UUID:mdadm --detail md1 | grep UUID
90891edf:c52308ab:e5286c90:0e46d5f5

vim mdadm.conf
插入ARRAY /dev/md1 UUID=90891edf:c52308ab:e5286c90:0e46d5f5保存退出

vim /etc/fstab
最后一行写入/dev/md1 /mnt/raid5 ext3 defaults 0 0 保存退出

4.创建用户
添加组feng和feng1到feng10 十个用户
#!/bin/bash
groupadd feng
for username in feng1 feng2 feng3 feng4 feng5 feng6 feng7 feng8 feng9 feng10
do
useradd -g feng $username
echo "123456" | passwd --stdin $username
done
sh useradd.sh执行成功
用户ip地址:192.168.0.1-10

5.加载配额
vim /etc/fstab
最后一行添加/dev/md1 /mnt ext3 defaults,usrquota,grpquota 0 0保存退挂载所有文件mount -a
查看挂载是否成功 mount
建立数据文件:quotacheck -avug
启动配额:quotaon -avug
编辑配额:edquota -u feng1
soft:200000KB hard:300000
复制用户配置:edquota -p feng1 -u feng2;edquota -p feng1 -u feng3;edquota -p feng1 -u feng4;edquota -p feng1 -u feng5;edquota -p feng1 -u feng6;edquota -p feng1 -u feng7;edquota -p feng1 -u feng8;edquota -p feng1 -u feng9;edquota -p feng1 -u feng10

软连接 ln -s /home /mnt
出现home字样

服务日志
客户端中vim /etc/syslog.conf 添加*.* @192.168.0.100
重启网卡:service network restart
服务器中vim /etc/sysconfig/syslog 修改SYSLOAD_OPTIONS="-m o -r"
重启服务:service syslog restart
查看日志:tail -f /var/log/message

[root@localhost ~]# chmod o+w /mnt/raid5
[root@localhost ~]# ll -d /mnt/raid5
[root@localhost ~]# su - user1
[user1@localhost ~]$ cd /mnt/raid5
[user1@localhost raid5]$ dd if=/dev/zero of=feng1 bs=1M count=200
[user1@localhost raid5]$ dd if=/dev/zero of=feng11 bs=1M count=35
md1: write failed, user block limit reached.
dd: 写入 “feng11”: 超出磁盘限额.

你可能感兴趣的:(raid)