raid(磁盘阵列)分为软、硬二种:
软raid
硬raid
raid 0 1 5 10
raid0 :
优点:读写速度加快
缺点:不安全
raid1:
优点:读取速度快,安全
缺点:写入速度慢
raid10:radi1和raid0的集合
raid5:
优点和缺点介于0和1之间
准备4个新分区:
或者:
主设备号
次设备号
创建设备文件:
mknod
/proc/devices
[root@station230 dev]# mdadm -Ds > /etc/mdadm.conf
[root@station230 dev]# echo 'mount /dev/md0 /mnt/md0' >> /etc/rc.local
[root@station230 dev]# vim /etc/fstab
/dev/md0 /mnt/md0 ext3 defaults 0 0
[root@station230 dev]# mdadm -D /dev/md0
Number Major Minor RaidDevice State
0 8 7 0 active sync /dev/sda7
1 8 10 1 active sync /dev/sda10
2 8 9 2 active sync /dev/sda9
3 8 8 - faulty spare /dev/sda8
[root@station230 dev]# mdadm -f /dev/md0 /dev/sda8
mdadm: set /dev/sda8 faulty in /dev/md0
[root@station230 dev]# mdadm -D /dev/md0
Number Major Minor RaidDevice State
0 8 7 0 active sync /dev/sda7
1 8 10 1 active sync /dev/sda10
2 8 9 2 active sync /dev/sda9
3 8 8 - faulty spare /dev/sda8
[root@station230 dev]# mdadm -r /dev/md0 /dev/sda8
mdadm: hot removed /dev/sda8
[root@station230 dev]# mdadm -a /dev/md0 /dev/sda8
mdadm: added /dev/sda8
LVM(逻辑卷)
创建4个分区:
创建Pv:
创建并加入卷组:
创建lv:
创建文件系统:
[root@station230 dev]# mkdir /mnt/lv0
[root@station230 dev]# mkfs.ext3 /dev/vg0/lv0
[root@station230 dev]# mount /dev/vg0/lv0 /mnt/lv0
[root@station230 dev]# cd /mnt/lv0
[root@station230 lv0]# ls
lost+found
查看:
[root@station230 lv0]# pvdisplay
[root@station230 lv0]# pvscan
[root@station230 lv0]# vgdisplay
[root@station230 lv0]# vgscan
[root@station230 lv0]# lvdisplay
[root@station230 lv0]# lvscan
扩容:
扩大vg:
扩大lv:
或者:
[root@station230 lv0]# lvextend -L +30M /dev/vg0/lv0
[root@station230 lv0]# resize2fs /dev/vg0/lv0 100M
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg0/lv0 is mounted on /mnt/lv0; on-line resizing required
Performing an on-line resize of /dev/vg0/lv0 to 102400 (1k) blocks.
The filesystem on /dev/vg0/lv0 is now 102400 blocks long.