lvm 务实
时间:2006-10-25 来源:longtem
假设现在给及其添加了两个scsi硬盘:sdb,sdc
sdb:20G,spare disk without a partition table
sdc:sdc1,100M;sdc2,1G;sdc3,5G
准备把两个盘都用作Logic Volume Group
Step:
====================
1:format
#pvcreate /dev/{sdb,sdc{1,2,3}}
====================
2:make the group
#vgcreate TEST /dev/{sdb,sdc{1,2}}
====================
3:make the logic volume
#lvcreate -L 1G TEST -n a
#lvcreate -L 1.5G TEST -n b
=====================
Other optation:
----------------
resize the logic volume
#lvresize -L +128M /dev/TEST/a //add 128M to /dev/TEST/a
#lvresize -L -57M /dev/TEST/a //wanna decrease 57M from /dev/TEST/a, but 60M in fact
#lvresize -L -56M /dev/TEST/a /decrease 56M from a
----------------
delete a logic volume
#lvremove /dev/TEST/a //delete /dev/TEST/a
----------------
add one more partion to the volume group
#vgextend TEST /dev/sdc3 //add /dev/sdc3 to the group. Notice, adc has been formatted as pv
======================
4:format the logic volume
#mkfs -t ext3 /dev/TEST/a //wondering why "-t vfat" doesn't work
//never use fdisk /dev/TEST/a, though it works
======================
5:auto moute
add "/dev/TEST/a /mnt ext3 default 0 0" to /etc/fstab
======================
6:最后一步:激活新增的空间
ext2online /dev/TEST/a
======================
遗留的问题:
当想卸载一个pv的时候,很麻烦。得用暴力选项 -ff. 这样很容易造成文件整体丢失:
假设第一个盘的崩溃的概率是1-C1, 第i个的是1-Ci,则有m个盘组成的一个群的崩溃率为 1-C1C2...Cm
sdb:20G,spare disk without a partition table
sdc:sdc1,100M;sdc2,1G;sdc3,5G
准备把两个盘都用作Logic Volume Group
Step:
====================
1:format
#pvcreate /dev/{sdb,sdc{1,2,3}}
====================
2:make the group
#vgcreate TEST /dev/{sdb,sdc{1,2}}
====================
3:make the logic volume
#lvcreate -L 1G TEST -n a
#lvcreate -L 1.5G TEST -n b
=====================
Other optation:
----------------
resize the logic volume
#lvresize -L +128M /dev/TEST/a //add 128M to /dev/TEST/a
#lvresize -L -57M /dev/TEST/a //wanna decrease 57M from /dev/TEST/a, but 60M in fact
#lvresize -L -56M /dev/TEST/a /decrease 56M from a
----------------
delete a logic volume
#lvremove /dev/TEST/a //delete /dev/TEST/a
----------------
add one more partion to the volume group
#vgextend TEST /dev/sdc3 //add /dev/sdc3 to the group. Notice, adc has been formatted as pv
======================
4:format the logic volume
#mkfs -t ext3 /dev/TEST/a //wondering why "-t vfat" doesn't work
//never use fdisk /dev/TEST/a, though it works
======================
5:auto moute
add "/dev/TEST/a /mnt ext3 default 0 0" to /etc/fstab
======================
6:最后一步:激活新增的空间
ext2online /dev/TEST/a
======================
遗留的问题:
当想卸载一个pv的时候,很麻烦。得用暴力选项 -ff. 这样很容易造成文件整体丢失:
假设第一个盘的崩溃的概率是1-C1, 第i个的是1-Ci,则有m个盘组成的一个群的崩溃率为 1-C1C2...Cm
相关阅读 更多 +