Linux LVM镜像逻辑卷解决冗余问题,类似raid1

pvcreate /dev/sdb
pvcreate /dev/sdc
pvcreate /dev/sdd


vgcreate vg_mirror /dev/sdb /dev/sdc /dev/sdd


lvcreate -m2 --mirrorlog mirrored --alloc anywhere -n lv-mirror -L 10G vg-mirror


lvcreate -m2  -n lv_mirror -L 10G vg_mirror




lvs -a -o +devices




mkfs.ext4  /dev/vg_mirror/lv_mirror


mount /dev/mapper/vg_mirror-lv_mirror /mirror  




dd if=/dev/zero of=/dev/sdd bs=512 count=100




pvremove --froce --force /dev/sdd




--移除
vgreduce --removemissing vg_mirror --force


--恢复
lvconvert -m2 --mirrorlog mirrored --alloc anywhere /dev/vgtst/tstlv_mirror1 /dev/sdb /dev/sdc /dev/sdd
lvconvert -m2  -n /dev/mapper/vg_mirror-lv_mirror /dev/sdb /dev/sdc /dev/sdd






mount -o noatime,nodiratime /dev/vgtst/tstlv_mirror1 /tst1
mount -o noatime,nodiratime /dev/vgtst/tstlv_mirror2 /tst2

你可能感兴趣的:(Linux)