raid(磁盘阵列)分为软、硬二种:
raid 0 1 5 10
raid1: raid10:radi1和raid0的集合
raid5:
准备4个新分区:
复制代码代码示例:
[root@station230 ~]# mdadm --create /dev/md0 --level=5 --raid-devices=3 --spare-devices=1 /dev/sda{7,8,9,10}
或者:
复制代码代码示例:
[root@station230 md0]# mdadm -C /dev/md0 -l 5 -n 3 -x 1 /dev/sda{7,8,9,10}
[root@station230 md0]# mdadm -D /dev/md0 [root@station230 md0]# mdadm -Ds [root@station230 md0]# mkfs.ext3 /dev/md0 [root@station230 ~]# mkdir /mnt/md0 [root@station230 ~]# mount /dev/md0 /mnt/md0 [root@station230 ~]# cd /mnt/md0 [root@station230 md0]# ls lost+found
主设备号
创建设备文件:
复制代码代码示例:
mknod /proc/devices
[root@station230 dev]# mdadm -Ds > /etc/mdadm.conf
[root@station230 dev]# mdadm -D /dev/md0
[root@station230 dev]# mdadm -f /dev/md0 /dev/sda8
[root@station230 dev]# mdadm -D /dev/md0
[root@station230 dev]# mdadm -r /dev/md0 /dev/sda8 lvm(逻辑卷)
创建4个分区:
复制代码代码示例:
[root@station230 ~]# pvcreate /dev/sda{11,12,13,14}
Physical volume "/dev/sda11" successfully created Physical volume "/dev/sda12" successfully created Physical volume "/dev/sda13" successfully created Physical volume "/dev/sda14" successfully created
创建并加入卷组:
复制代码代码示例:
[root@station230 ~]# vgcreate vg0 /dev/sda{11,12,13}
Volume group "vg0" successfully created
创建lv:
复制代码代码示例:
[root@station230 dev]# lvcreate -L 70M -n lv0 vg0
Rounding up size to full physical extent 72.00 MB Logical volume "lv0" created
创建文件系统:
复制代码代码示例:
[root@station230 dev]# mkdir /mnt/lv0
[root@station230 dev]# mount /dev/vg0/lv0 /mnt/lv0
查看:
复制代码代码示例:
[root@station230 lv0]# pvdisplay
[root@station230 lv0]# vgdisplay
[root@station230 lv0]# lvdisplay
扩容:
复制代码代码示例:
[root@station230 lv0]# vgextend vg0 /dev/sda14
Volume group "vg0" successfully extended
扩大lv:
复制代码代码示例:
[root@station230 lv0]# lvextend -L 100M /dev/vg0/lv0
Extending logical volume lv0 to 100.00 MB Logical volume lv0 successfully resized
或者:
复制代码代码示例:
[root@station230 lv0]# lvextend -L +30M /dev/vg0/lv0
[root@station230 lv0]# resize2fs /dev/vg0/lv0 100M lvm缩容: 卸载:
复制代码代码示例:
[root@station230 ~]# umount /dev/vg0/lv0
检查文件系统:
复制代码代码示例:
[root@station230 ~]# e2fsck -f /dev/vg0/lv0
e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/vg0/lv0: 11/26624 files (9.1% non-contiguous), 9031/102400 blocks
文件系统级别缩容:
复制代码代码示例:
[root@station230 ~]# resize2fs /dev/vg0/lv0 80M
resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/vg0/lv0 to 81920 (1k) blocks. The filesystem on /dev/vg0/lv0 is now 81920 blocks long.
lv缩容:
复制代码代码示例:
[root@station230 ~]# lvreduce -L -20M /dev/vg0/lv0
[root@station230 ~]# vgreduce vg0 /dev/sda14
[root@station230 ~]# pvremove /dev/sda14
[root@station230 ~]# vgremove vg0
lvm快照:
复制代码代码示例:
[root@station230 lv0]# lvcreate -s /dev/vg0/lv0 -n lv0bak -L 20M
[root@station230 lv0bak]# lvscan
替换物理卷:
复制代码代码示例:
[root@station230 lv0bak]# pvcreate /dev/sda14
Physical volume "/dev/sda14" successfully created [root@station230 lv0bak]# vgextend vg0 /dev/sda14 Volume group "vg0" successfully extended
移动数据:
复制代码代码示例:
[root@station230 ~]# pvmove /dev/sda11 /dev/sda14
/dev/sda11: Moved: 100.0%
移出旧pv:
复制代码代码示例:
[root@station230 ~]# vgreduce vg0 /dev/sda11
Removed "/dev/sda11" from volume group "vg0" [root@station230 ~]# cd /mnt/lv0 [root@station230 lv0]# ls a b c d lost+found 迁移:
原来的主机:
复制代码代码示例:
[root@station230 ~]# umount /dev/vg0/lv0
[root@station230 ~]# vgchange -a n vg0 0 logical volume(s) in volume group "vg0" now active [root@station230 ~]# vgexport vg0 Volume group "vg0" successfully exported
替换的主机:
复制代码代码示例:
[root@station230 ~]# vgimport vg0
(责任编辑:IT)Volume group "vg0" successfully imported [root@station230 ~]# vgchange -a y vg0 1 logical volume(s) in volume group "vg0" now active [root@station230 ~]# mount /dev/vg0/lv0 /mnt/lv0 |