一、前期准备
1.配置IP和远程主机、添加五块硬盘
2.修改主机名
3.下载评卷脚本
cd
yum install wget -y
wget http:// 8.130.49.114/grade/grade.sh
sh grade.sh 8.130.49.114 exercise 个人实时完成情况可以通过 “http://服务器 IP/results”查看
4.如需要配置yum源
vim /etc/yum.repos.d/cdrom.repo
[cdrom]
name=cdrom
baseurl=file:///mnt
enable=1
gpgcheck=0
二、RAID5(直接复制)
mount /dev/cdrom /mnt
yum install mdadm -y
mdadm -Cv /dev/md5 -l5 -n3 -x1 /dev/sd[b-e]
mdadm -D /dev/md5
三、lv扩展(直接复制)
pvcreate /dev/sdf
vgextend rhel /dev/sdf
lvextend /dev/rhel/root -L 19G -r
四、lv应用
pvcreate /dev/md5
vgcreate vg-a /dev/md5
lvcreate vg-a -n lv-a -L 9G
mkfs.ext4 /dev/vg-a/lv-a
mkdir /folder-a
vim /etc/fstab(修改下行)
/dev/vg-a/lv-a /folder-a ext4 defaults 0 0
mount -a
五、rsync配置
yum install rsync -y
vim /etc/rsyncd.conf
uid = rsync-a
gid = rsync-a
use chroot = yes
max connections = 4
pid file = /var/run/rsyncd.pid
exclude = lost+found/
transfer logging = yes
timeout = 900
ignore nonreadable = yes
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
fake super = yes
read only = no
[module-a]
path = /folder-a
comment = ftp export area
secrets file = /etc/rsyncd.secrets
auth users == rsync_a
useradd -M -s /sbin/nologin rsync-a
chown rsync-a:rsync-a /folder-a
echo "rsync_a:123" > /etc/rsyncd.secrets
chmod 600 /etc/rsyncd.secrets
systemctl restart rsyncd
systemctl enable rsyncd
firewall-cmd --add-service=rsyncd
firewall-cmd --add-service=rsyncd –permanent
setsebool -P rsync_full_access on
六、shell脚本
rsync -av /etc/passwd rsync_a@192.168.14.201::module-a
vim shell202.sh
#!/bin/bash
Date=$(date +%F-%H-%M)
Host=$(hostname)
[ -d /backup ] || mkdir /backup
tar czvf /backup/${Host}_${Date}_grub2.tar.gz /boot/grub2
export RSYNC_PASSWORD=123
rsync -av /backup/${Host}_${Date}_grub2.tar.gz rsync_a@192.168.14.201::module-a
sh -x shell202.sh
crontab -e
*/3 * * * * sh /root/shell202.sh
RAID1
mdadm -C /dev/md1 -l1 -n2 -x1 /dev/sd[b-d]
mdadm -D /dev/md1
RAID0
mdadm -C /dev/md0 -l0 -n2 -x1 /dev/sd[b-d]
mdadm -D /dev/md0
RAID5
mdadm -Cv /dev/md5 -l5 -n3 -x1 /dev/sd[b-e]
mdadm -D /dev/md5
RAID1+0 无热备需要4硬盘
mdadm -Cv /dev/md1 -l1 -n2 /dev/sd[c,d]
mdadm -Cv /dev/md2 -l1 -n2 /dev/sd[e,f]
mdadm -Cv /dev/md3 -l0 -n2 /dev/md[1,2]
RAID0+1 无热备需要4硬盘
mdadm -Cv /dev/md1 -l0 -n2 /dev/sd[c,d]
mdadm -Cv /dev/md2 -l0 -n2 /dev/sd[e,f]
mdadm -Cv /dev/md3 -l1 -n2 /dev/md[1,2]
需要热备就-a添加到对应的
如
mdadm /dev/md3 -a /dev/sdg